Save Quest Data [Solved]
-
- Posts: 2
- Joined: Mon Apr 20, 2020 10:42 pm
Save Quest Data [Solved]
I'm following along with the GameDevTV Unity RPG course and just want to save and load quest data. Saving and loading works when switching scenes, but when I quit the unity editor and play/load it doesn't load the quest data.
- Attachments
-
- Capture.PNG (111.25 KiB) Viewed 275 times
Last edited by thereaper43 on Tue Apr 21, 2020 7:35 pm, edited 1 time in total.
Re: Save Quest Data
Hi,
The end of your SaveData method gets the data from the Dialogue System:
but it doesn't save it anywhere. I'm not familiar with that RPG tutorial, but you might be able to do something like this:
BTW, the Dialogue System comes with a very robust save system.
The end of your SaveData method gets the data from the Dialogue System:
Code: Select all
s = PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData();
Code: Select all
public void Save(string saveFile)
{
Dictionary<string, object> state = LoadFile(saveFile);
CaptureState(state);
s = PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData();
state.Add("DialogueSystem", s);
SaveFile(saveFile, state);
}
public IEnumerator Load(string saveFile)
{
int buildIndex = SceneManager.GetActiveScene().buildIndex;
yield return SceneManager.LoadSceneAsync(buildIndex);
RestoreState(LoadFile(saveFile));
s = state["DialogueSystem"]; //<-- DEPENDS ON state CONTAINING VALID DATA & KEY NAMED "DialogueSystem".
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(s);
}
-
- Posts: 2
- Joined: Mon Apr 20, 2020 10:42 pm
Re: Save Quest Data
Thanks a lot, Tony!
Went through the Dialogue System docs and found a solution.
Went through the Dialogue System docs and found a solution.
Re: Save Quest Data [Solved]
Great! Glad to help.