Must LoadFromSlot twice to load variables
Posted: Mon Feb 27, 2023 1:41 pm
Hi Tony,
Had a question about loading variables from Lua when selecting to SaveSystemMethods.LoadFromSlot(0) using a button in a menu after Unity goes in and out of Play mode.
We have our game set up to read/load from Lua and the assign values to our player after reading them in from a save slot. Loading and assigning works fine when the game is running and then we Save -> then Load. However, if we save then press Play, and turn off Unity and then hit Play again and attempt to Load again, the values get set very late and the Player is unable to retrieve the values in Lua on time it seems. If we press Load again, then it seems to work, since the Lua variables have been loaded in from the first Load attempt. Is there an event we can listen to perhaps that says the Lua variables have been initialized after Load or is there some other way to handle ordering? Would appreciate any direction on how to handle this!
Thanks!
Had a question about loading variables from Lua when selecting to SaveSystemMethods.LoadFromSlot(0) using a button in a menu after Unity goes in and out of Play mode.
We have our game set up to read/load from Lua and the assign values to our player after reading them in from a save slot. Loading and assigning works fine when the game is running and then we Save -> then Load. However, if we save then press Play, and turn off Unity and then hit Play again and attempt to Load again, the values get set very late and the Player is unable to retrieve the values in Lua on time it seems. If we press Load again, then it seems to work, since the Lua variables have been loaded in from the first Load attempt. Is there an event we can listen to perhaps that says the Lua variables have been initialized after Load or is there some other way to handle ordering? Would appreciate any direction on how to handle this!
Thanks!