Dialogue System variable values not being saved.
Dialogue System variable values not being saved.
Hey Tony,
Hope you've been having a good holiday.
I'm currently having some issues with database variables - pretty simple setup with 4 boolean variables. I have Dialogue System Saver on my dialogue system object.
The variables are correctly stored when changing scenes - I see the values correctly being saved by pressing "Show" on the PlayerPrefsSavedGameDataStorer.
However, once I manually save the game with SaveSystem.SaveToSlot(0) - all of the variables are reverted back to their original values.
Any idea what might be causing these variables to not correctly save?
- Frank
Hope you've been having a good holiday.
I'm currently having some issues with database variables - pretty simple setup with 4 boolean variables. I have Dialogue System Saver on my dialogue system object.
The variables are correctly stored when changing scenes - I see the values correctly being saved by pressing "Show" on the PlayerPrefsSavedGameDataStorer.
However, once I manually save the game with SaveSystem.SaveToSlot(0) - all of the variables are reverted back to their original values.
Any idea what might be causing these variables to not correctly save?
- Frank
Re: Dialogue System variable values not being saved.
Hi Frank,
Do the variables go back to their original values immediately after calling SaveSystem.SaveToSlot(0)? Or does something happen after that, such as calling some other C# code or stopping and restarting play mode?
Do the variables have their saved values if you load the game in slot 0?
Do the variables go back to their original values immediately after calling SaveSystem.SaveToSlot(0)? Or does something happen after that, such as calling some other C# code or stopping and restarting play mode?
Do the variables have their saved values if you load the game in slot 0?
Re: Dialogue System variable values not being saved.
I have PlayerPrefsSavedGameDataStorer set to debug, the first action that occurs when selecting "return to title" from the options menu is the SaveToSlot() method. The output is an immediate json with all the values being reverted.
The code running after is: PixelCrushers.SaveSystem.RestartGame("MainMenu").
The code running after is: PixelCrushers.SaveSystem.RestartGame("MainMenu").
Re: Dialogue System variable values not being saved.
SaveSystem.RestartGame() will reset all data in memory (save data and Dialogue System variables/quests), and then load a starting gameplay scene.
Re: Dialogue System variable values not being saved.
Yeah, commenting out that line worked.
I thought the json was separate from the cached save data that is being cleared?
I had no issues with it retaining all other data outside of these variables. What would be the proper solution to return to a main menu and essentially "restart" the game after SaveToSlot() is called?
I thought the json was separate from the cached save data that is being cleared?
I had no issues with it retaining all other data outside of these variables. What would be the proper solution to return to a main menu and essentially "restart" the game after SaveToSlot() is called?
Re: Dialogue System variable values not being saved.
The data that PlayerPrefsSavedGameDataStorer stores in persistent storage is different from the data that is cached in memory.
SaveSystem.RestartGame() (or SaveSystem.ResetGameState() if you don't want to load a scene) only clears the data that is cached in memory.
Is it possible that you're calling SaveSystem.SaveToSlot(0) again after calling SaveSystem.RestartGame()?
SaveSystem.RestartGame() (or SaveSystem.ResetGameState() if you don't want to load a scene) only clears the data that is cached in memory.
Is it possible that you're calling SaveSystem.SaveToSlot(0) again after calling SaveSystem.RestartGame()?
Re: Dialogue System variable values not being saved.
I've been digging around, but the setup is pretty straight forward.
To be sure, I removed this and there were no changes.
When selecting debug, it only outputs the json result once. For extra measure I also added a Debug.Log() in the RecordSavedGameData() method, and this also only fires off once.
- SaveToSlot()
- RestartGame("MainMenu")
To be sure, I removed this and there were no changes.
When selecting debug, it only outputs the json result once. For extra measure I also added a Debug.Log() in the RecordSavedGameData() method, and this also only fires off once.
Re: Dialogue System variable values not being saved.
At what point are the Dialogue System variables reset? After calling SaveSystem.RestartGame()? If so, that's exactly what should be expected.
Is your Dialogue Manager configured with the default Don't Destroy On Load value? If you're not allowing the Dialogue Manager to survive scene changes, then it will lose its variables when you change scenes.
If that doesn't help, please feel free to send a reproduction project to tony (at) pixelcrushers.com
Is your Dialogue Manager configured with the default Don't Destroy On Load value? If you're not allowing the Dialogue Manager to survive scene changes, then it will lose its variables when you change scenes.
If that doesn't help, please feel free to send a reproduction project to tony (at) pixelcrushers.com
Re: Dialogue System variable values not being saved.
For the time being, I've removed the RestartGame line and just have the scene changing to the main menu. From there, new game will wipe the data anyways, and continue will load the proper stored data.
Re: Dialogue System variable values not being saved.
Sounds good. That'll get the job done.