I tried to use DialogueLua.GetVariable to change my variable, but it doesn't change the value in "Dialogue System -> Variable", even though it seems to work by looking at the console output:
Below is my code and console output:
Debug.Log(DialogueLua.GetVariable("PlayerName").asString);
//console output: Name
DialogueLua.SetVariable("PlayerName", "123");
Debug.Log(DialogueLua.GetVariable("PlayerName").asString);
//console output: 123
However, after running the code above, in Dialogue System "PlayerName" remains "Name". In addition, the next a few lines which use [var=PlayerName] all give me "Name" instead of "123". Am I missing something?
Thank you!
Variable name not updated in dialogue
Variable name not updated in dialogue
- Attachments
-
- PlayerName.PNG (2.98 KiB) Viewed 162 times
Re: Variable name not updated in dialogue
Hi,
The Dialogue Editor's Variables tab shows the Initial Value of the variable, not its current value.
To see the current value, use the Dialogue Editor's Watches tab or the separate Variable Viewer window. A quick way to open the Variable Viewer window from the Dialogue Editor's Variables tab is to select Menu > Variable Viewer. The other way to open the Variable Viewer is to select menu item Tools > Pixel Crushers > Dialogue System > Tools > Variable Viewer.
The Dialogue Editor's Variables tab shows the Initial Value of the variable, not its current value.
To see the current value, use the Dialogue Editor's Watches tab or the separate Variable Viewer window. A quick way to open the Variable Viewer window from the Dialogue Editor's Variables tab is to select Menu > Variable Viewer. The other way to open the Variable Viewer is to select menu item Tools > Pixel Crushers > Dialogue System > Tools > Variable Viewer.
Re: Variable name not updated in dialogue
Hi Tony,
Thank you for letting me know about this function. This is quite handy.
I realized that after a variable is changed (in runtime), the line that is already linked to would still use the previous value of the variable. The rest of the conversation would use the new value.
I think I am OK now. Thank you for the quick reply.
Thank you for letting me know about this function. This is quite handy.
I realized that after a variable is changed (in runtime), the line that is already linked to would still use the previous value of the variable. The rest of the conversation would use the new value.
I think I am OK now. Thank you for the quick reply.
Re: Variable name not updated in dialogue
Happy to help!