Saving Dialogue Database
-
- Posts: 11
- Joined: Thu Jun 06, 2024 9:37 pm
Saving Dialogue Database
Hello. I specifically only want to save and load a dialogue database (I have another save system for most everything else). I was wondering what the easiest way would be to save and load by using an onclick() event from a button. Thanks
Re: Saving Dialogue Database
Hi,
To save and load only the database in C#, please see Dialogue Database-Only Save. It one line of code each for save and load, which puts the dialogue database save data in a string. You can include that string in your own save system if youwant.
To save and load to persistent storage (e.g., disk or PlayerPrefs) using a UI Button, you'll need to set up a minimal version of the save system:
1. Add these components to the Dialogue Manager: SaveSystem, DialogueSystemSaver, JsonDataSerializer, and PlayerPrefsSavedGameDataStorer or DiskSavedGameDataStorer.
2. UNtick the SaveSystem component's Save Current Scene.
3. Set the DialogueSystemSaver's Key to a unique value such as "ds".
4. Add a SaveSystemMethods component to your UI Button. Configure the Button's OnClick() to call SaveSystemMethods.SaveToSlot or LoadFromSlot.
To save and load only the database in C#, please see Dialogue Database-Only Save. It one line of code each for save and load, which puts the dialogue database save data in a string. You can include that string in your own save system if youwant.
To save and load to persistent storage (e.g., disk or PlayerPrefs) using a UI Button, you'll need to set up a minimal version of the save system:
1. Add these components to the Dialogue Manager: SaveSystem, DialogueSystemSaver, JsonDataSerializer, and PlayerPrefsSavedGameDataStorer or DiskSavedGameDataStorer.
2. UNtick the SaveSystem component's Save Current Scene.
3. Set the DialogueSystemSaver's Key to a unique value such as "ds".
4. Add a SaveSystemMethods component to your UI Button. Configure the Button's OnClick() to call SaveSystemMethods.SaveToSlot or LoadFromSlot.
-
- Posts: 11
- Joined: Thu Jun 06, 2024 9:37 pm
Re: Saving Dialogue Database
it appears there is no option in the SaveSystemMethod for "SaveToSlot" only "LoadToSlot". There is only "SaveSlot". Not sure if this is the method that saves or if I'm missing it somehow.
-
- Posts: 11
- Joined: Thu Jun 06, 2024 9:37 pm
Re: Saving Dialogue Database
Also is there a way to call the "SaveToSlot" or "LoadFromSlot" methods in a script? I have an auto save function so I want to be able to save and load with that alongside an OnClick() event with a button.
Re: Saving Dialogue Database
Hi,
If you're using the save system, you can call SaveSystem.SaveToSlot() and LoadFromSlot() in a script.
However, if you only want to save the dialogue database from a script, you can use the two methods in the link above (PersistentDataManager.GetSaveData() and ApplySaveData()).
If you're using the save system, you can call SaveSystem.SaveToSlot() and LoadFromSlot() in a script.
However, if you only want to save the dialogue database from a script, you can use the two methods in the link above (PersistentDataManager.GetSaveData() and ApplySaveData()).
-
- Posts: 11
- Joined: Thu Jun 06, 2024 9:37 pm
Re: Saving Dialogue Database
Hi,
When I load a saved state from a scene I've already been in before during runtime saving and loading the dialogue database seems to work no problem. If I save the dialogue database in a scene and exit runtime and then go back into play mode and load into a scene and attempt to load the saved dialogue database from that scene it appears the saved state does not persist.
When I load a saved state from a scene I've already been in before during runtime saving and loading the dialogue database seems to work no problem. If I save the dialogue database in a scene and exit runtime and then go back into play mode and load into a scene and attempt to load the saved dialogue database from that scene it appears the saved state does not persist.
Re: Saving Dialogue Database
How are you saving and loading? PersistentDataManager.GetSaveData() and ApplySaveData()?
-
- Posts: 11
- Joined: Thu Jun 06, 2024 9:37 pm
Re: Saving Dialogue Database
I'm still using the OnClick() event for SaveSystemMethods.SaveSlot() to save and SaveSystemMethods.LoadFromSlot() to load. Is there a way to use PersistentDataManager.GetSaveData() and ApplySaveData() for an OnClickEvent()? If so what component needs to be added to the button to do this as I don't see either option in the Save System Methods
-
- Posts: 11
- Joined: Thu Jun 06, 2024 9:37 pm
Re: Saving Dialogue Database
Ah I see the button in a different scene wasn't hooked up with the proper saving and loading methods mentioned earlier. Everythings looking good now. Thanks for all the help!
Re: Saving Dialogue Database
Glad to help!