Page 1 of 1
Bypass Save / Load System?
Posted: Mon Nov 26, 2018 4:22 pm
by torahhorse
I'm looking to integrate Dialogue System with my existing save system. I only need to save the variable data from the database and apply it back to the database when I load. Ideally I could just get and set a serializable object from the database and pass it to my save system. Is there a straightforward way to do that? Thanks!
Re: Bypass Save / Load System?
Posted: Mon Nov 26, 2018 5:32 pm
by Tony Li
Sure! You can remove any save components that might be on the Dialogue Manager GameObject (Dialogue System Saver, Save System, Data Serializer, Saved Game Data Storer) or just leave them there unused.
When saving a game, call this line of code to get the Dialogue System's data as a serialized string:
Code: Select all
string s = PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData();
When loading a saved game, after you retrieve that string from your save system, call this line of code to put it back into the Dialogue System:
Code: Select all
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(s);
API Reference:
PersistentDataManager
Re: Bypass Save / Load System?
Posted: Mon Nov 26, 2018 5:46 pm
by torahhorse
This sounds like just what I was looking for. Thanks for the quick reply!
Re: Bypass Save / Load System?
Posted: Mon Nov 26, 2018 5:55 pm
by Tony Li
Glad to help!