Page 1 of 1
Load different state configuration at any point
Posted: Mon Aug 30, 2021 9:56 pm
by mstie
As our game gets more complex, we'd like to be able to start the game at any point with different variables and quest state settings that we have prescribed.
I'm looking for the best way to do this. Should we save these out via Save System or Easy Save and load these back in when we need them or is there a better way of doing this?
Re: Load different state configuration at any point
Posted: Mon Aug 30, 2021 10:20 pm
by Tony Li
Hi,
If you're already using the Save System, you can save and load saved games. Or, if you don't want to actually save the game, you can tell the Save System to record the current game state:
Code: Select all
SavedGameData data = PixelCrushers.SaveSystem.RecordSavedGameData();
and then later apply that data back into the game:
Code: Select all
PixelCrushers.SaveSystem.ApplySavedGameData(data);
If you're not using the Save System and you only want to save variables and quest states, you can use the PersistentDataManager class:
Code: Select all
string s = PersistentDataManager.GetSaveData();
and:
Code: Select all
PersistentDataManager.ApplySaveData(s);
Re: Load different state configuration at any point
Posted: Tue Aug 31, 2021 12:49 am
by mstie
Thanks. That helps a lot.
Re: Load different state configuration at any point
Posted: Tue Aug 31, 2021 6:08 am
by Tony Li
Happy to help!