inkle / inkle/ink

[beginner question] Ink in unity, can't get variable

Open
#357 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.9k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

Hello, I'm having some problems with getting variables from a .ink file in unity. The player through a dialog can choose if leaving the level and then with a script I load the scene if the player chose to leave.
Here's the .ink
```
VAR exit=0 //1:yes 0:no

Should I leave?
*[Yes]
~exit=1
->END
*[No]
~exit=0
->END
```
and with this script I check what the player has chosen
```
[SerializeField]
TextAsset ext_level_asset;
public Story ext_level_story;
int exit_level;

private void Awake()
{
ext_level_story = new Story(ext_level_asset.text);
}
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
exit_level = (int)ext_level_story.variablesState["exit"];
}
```
The problem is that it seems to completely ignore the part in the update, and when I try to change it through the inspector it goes back to 0. How can I solve it?
Thank you very much.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.