Hi, i want to save Dialogue Variable without Dont Destroy On Load. is it possible?
If i add component 'Save System', i can save Variable, but it says Dialogue Manager will be 'Dont Destroy On Load'.
Is there any different way to save Variable without that??
Thank you.
Saving Variable without Dont Destroy On Load
-
- Posts: 29
- Joined: Sat Jan 02, 2021 4:27 pm
Re: Saving Variable without Dont Destroy On Load
Hi,
Yes, there are two ways:
1. Put the Save System component on a different GameObject. That GameObject will be Dont Destroy On Load. Add a Dialogue System Saver component to the Dialogue Manager.
2. Or call PersistentDataManager.GetSaveData(). This will return a string containing the current variable values. To restore those values back into the Dialogue System, pass them to PersistentDataManager.ApplySaveData().
Yes, there are two ways:
1. Put the Save System component on a different GameObject. That GameObject will be Dont Destroy On Load. Add a Dialogue System Saver component to the Dialogue Manager.
2. Or call PersistentDataManager.GetSaveData(). This will return a string containing the current variable values. To restore those values back into the Dialogue System, pass them to PersistentDataManager.ApplySaveData().
-
- Posts: 29
- Joined: Sat Jan 02, 2021 4:27 pm
Re: Saving Variable without Dont Destroy On Load
Thank you for reply.
I tried a way No.1 but it doesn't save variable.
I created new object and put Save System component, and i put Dialogue System Saver component to Dialogue Manager Object. But it didn't save any variable
I tried a way No.1 but it doesn't save variable.
I created new object and put Save System component, and i put Dialogue System Saver component to Dialogue Manager Object. But it didn't save any variable
Re: Saving Variable without Dont Destroy On Load
From your other thread, it sounds like maybe you are now using the default setting: Don't Destroy On Load. If so, that's the easiest way to make variable values stay the same across scene changes.
Otherwise, if you use a Save System GameObject, you must change scenes using one of these techniques.
Otherwise, if you use a Save System GameObject, you must change scenes using one of these techniques.
-
- Posts: 29
- Joined: Sat Jan 02, 2021 4:27 pm
Re: Saving Variable without Dont Destroy On Load
I'm using different asset to change scene.
So Should i use the way No.2 'using code : PersistentDataManager.ApplySaveData().'?
Thank you for reply.
So Should i use the way No.2 'using code : PersistentDataManager.ApplySaveData().'?
Thank you for reply.
Re: Saving Variable without Dont Destroy On Load
Yes, you can either use PersistentDataManager.SaveGameData() before leaving the old scene and ApplyGameData() after entering the new scene.
Or, if you want to use the full save system, call these lines before leaving the old scene:
and call this line after entering the new scene:
Or, if you want to use the full save system, call these lines before leaving the old scene:
Code: Select all
PixelCrushers.SaveSystem.RecordSavedGameData();
PixelCrushers.SaveSystem.BeforeSceneChange();
Code: Select all
PixelCrushers.SaveSystem.ApplySavedGameData();