Save system and editor

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
urrmurrmur
Posts: 47
Joined: Wed May 05, 2021 1:57 pm

Save system and editor

Post 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 260 times
And a Dialogue System Saver component on my Dialogue System:
dialogue_system_saver.png
dialogue_system_saver.png (16.09 KiB) Viewed 260 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?
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save system and editor

Post 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.
urrmurrmur
Posts: 47
Joined: Wed May 05, 2021 1:57 pm

Re: Save system and editor

Post 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 ;)
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save system and editor

Post by Tony Li »

Glad you got it all working!
Post Reply