Page 1 of 1

Save system and editor

Posted: Mon Jul 01, 2024 2:51 pm
by urrmurrmur
Hi,

Question about the save system: what determines whether the dialogue system state is saved through editor play sessions? In my current system, the state of my dialogue system seems to be remembered in the editor, so every time I start the editor my variables have their state from the previous session. What I want is for them to start from their default values.

Context: I have a SaveManager object which is set up like this:
save_manager.png
save_manager.png (34.04 KiB) Viewed 263 times
And a Dialogue System Saver component on my Dialogue System:
dialogue_system_saver.png
dialogue_system_saver.png (16.09 KiB) Viewed 263 times
Any time I leave a scene, I call this code:

Code: Select all

SaveSystem.BeforeSceneChange();
SaveSystem.RecordSavedGameData();
And on starting a scene I call this:

Code: Select all

SaveSystem.ApplySavedGameData();
That's essentially my setup at the moment. I have one master DB with variables that need to be accessible in every scene, and each scene also has a scene-specific DB which doesn't contain any info that should be shared between scenes. For now the save system is only meant to remember the master DB variables between scene transitions, later I will probably save some extra stuff.

There are two things I don't understand:
  • The save file gets created, but it remains empty. Nothing ever gets saved in it.
  • When running the game in the editor, the variable status does get saved on scene transitions (intended). But besides that it keeps being remembered even after exiting play mode and restarting it again (unintended). When restarting the editor, everything does reset as expected.
I initially thought I was accidentally loading the game from the save file upon startup, but since the save file is empty, that can't be it. I assume the state also gets saved in a temporary file somewhere? Is there a way to disable that functionality, or to destroy that temporary file upon exiting play mode?

Re: Save system and editor

Posted: Mon Jul 01, 2024 7:10 pm
by Tony Li
Hi,

Is there an Auto Save Load component anywhere in your scene(s)?

If you're not using an Auto Save Load component, calling PixelCrushers.SaveSystem.SaveToSlot(#), or using the equivalent method in SaveSystemMethods (typically hooked up to UI Buttons), then it won't save the game to persistent storage (i.e., disk when you're using a Disk Saved Game Data Storer). When you're using Disk Saved Game Data Storer and you do save a game, you'll see a "save_#.dat" file in the same folder as saveinfo.dat. If you don't see a file like that, then it wasn't saved to disk.

Re: Save system and editor

Posted: Wed Jul 03, 2024 4:18 am
by urrmurrmur
Okay, thank you. That explains the save file part.

I managed to solve the other issue as well in the meantime (state getting remembered over play sessions). In case anyone comes across this thread at a later date: it had nothing to do with DSFU, it was just me misusing scriptable objects. Case closed ;)

Re: Save system and editor

Posted: Wed Jul 03, 2024 8:05 am
by Tony Li
Glad you got it all working!