Load different state configuration at any point

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
mstie
Posts: 2
Joined: Mon Aug 30, 2021 6:14 pm

Load different state configuration at any point

Post 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?
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Load different state configuration at any point

Post 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);
mstie
Posts: 2
Joined: Mon Aug 30, 2021 6:14 pm

Re: Load different state configuration at any point

Post by mstie »

Thanks. That helps a lot.
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Load different state configuration at any point

Post by Tony Li »

Happy to help!
Post Reply