Get Variables in Unity Start() method
Posted: Sun Jul 30, 2023 5:55 pm
Hi,
I use "SaveSystem.LoadFromSlot(1);"
and in the loaded scene want to do operations on DS Variables in Unity Start() method.
The variable is for ex. "MyVar" with initial to false.
in the game MyVar is changed to true with
DialogueLua.SetVariable("MyVar", true);
then saved, when next time game is DS Loaded and in the loaded scene from save, checking MyVar in Start() with
DialogueLua.GetVariable("MyVar").asBool > get false
But with afterwards method inside game gets true.
So my guess is in Start() variables are not Loaded from save, but some script updates it later.
Am I right? if so what is the workaround?
I use "SaveSystem.LoadFromSlot(1);"
and in the loaded scene want to do operations on DS Variables in Unity Start() method.
The variable is for ex. "MyVar" with initial to false.
in the game MyVar is changed to true with
DialogueLua.SetVariable("MyVar", true);
then saved, when next time game is DS Loaded and in the loaded scene from save, checking MyVar in Start() with
DialogueLua.GetVariable("MyVar").asBool > get false
But with afterwards method inside game gets true.
So my guess is in Start() variables are not Loaded from save, but some script updates it later.
Am I right? if so what is the workaround?