Bypass Save / Load System?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
torahhorse
Posts: 2
Joined: Mon Nov 26, 2018 4:13 pm

Bypass Save / Load System?

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

Re: Bypass Save / Load System?

Post 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
torahhorse
Posts: 2
Joined: Mon Nov 26, 2018 4:13 pm

Re: Bypass Save / Load System?

Post by torahhorse »

This sounds like just what I was looking for. Thanks for the quick reply!
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bypass Save / Load System?

Post by Tony Li »

Glad to help!
Post Reply