Variable does not refresh on Game Load
Posted: Sun Dec 12, 2021 4:00 am
Hi Tony,
I am currently experiencing some issues with variables not being refreshed upon a load game. I am currently using this guide to save and load my quest and dialogue states: https://www.pixelcrushers.com/phpbb/vie ... php?t=2796. I am confident the save/load functionality in the linked post above works, as I can successfully save / load quest states from quest machine. I just have issues with Dialogue System's variables that does not get properly loaded.
I have recently adopted the use of Dialogue System variables, mainly used to prevent the repetition of specific dialogue text. I would set variable["TalkedToGuard'] = true after talking to a guard, and set the conversation condition to variable["TalkedToGuard'] == false.
Let's say I save the game prior to talking to the guards, so variable["TalkedToGuard'] == false. However, after I spoke to the guards and load game via my in-game load UI button that uses the lines of code from the link above, the variables does not get loaded back to my previous save state (I.e. variable["TalkedToGuard'] is still true). Interestingly, I noticed that I can stop and start the game view via the Unity Editor's Play button, and using the exact same load functionality as with the in-game load UI button, the variables does get refreshed.
In summary, I have issues with having my variables refreshed using the in-game load UI button. A workaround would be to use Unity Editor's Play button to reload the game, which calls the exact same load functionality. I wonder if some of these variables are cached internally, and are only un-cached upon Unity's play button?
Thanks as always,
Derek
I am currently experiencing some issues with variables not being refreshed upon a load game. I am currently using this guide to save and load my quest and dialogue states: https://www.pixelcrushers.com/phpbb/vie ... php?t=2796. I am confident the save/load functionality in the linked post above works, as I can successfully save / load quest states from quest machine. I just have issues with Dialogue System's variables that does not get properly loaded.
I have recently adopted the use of Dialogue System variables, mainly used to prevent the repetition of specific dialogue text. I would set variable["TalkedToGuard'] = true after talking to a guard, and set the conversation condition to variable["TalkedToGuard'] == false.
Let's say I save the game prior to talking to the guards, so variable["TalkedToGuard'] == false. However, after I spoke to the guards and load game via my in-game load UI button that uses the lines of code from the link above, the variables does not get loaded back to my previous save state (I.e. variable["TalkedToGuard'] is still true). Interestingly, I noticed that I can stop and start the game view via the Unity Editor's Play button, and using the exact same load functionality as with the in-game load UI button, the variables does get refreshed.
In summary, I have issues with having my variables refreshed using the in-game load UI button. A workaround would be to use Unity Editor's Play button to reload the game, which calls the exact same load functionality. I wonder if some of these variables are cached internally, and are only un-cached upon Unity's play button?
Thanks as always,
Derek