Page 1 of 1

Load Game From Slot - Persistent Scene

Posted: Mon Jan 16, 2023 5:25 pm
by wkjp213
Hi there!

I have a Persistent Scene that is loaded by default when the game is started, the "Main Menu" is an object on this scene which is active while the rest of the game components are inactive (main game UI, player, etc.).

When I load a save from a slot with SaveSystem.LoadGameFromSlot I want it to load the scene that the game was saved in additively, and then make that scene the active scene, leaving the persistent scene loaded but no longer considered the primary scene.

It seems like when I call the SaveSystem.LoadGameFromSlot it's unloading my persistent scene and loading the saved scene, which of course is causing all kinds of errors because the persistent scene has all the game components, player, etc.

Is there an easy way to configure this that I may just be missing?

Really loving DS, QM, and LH so far! Excited to get over this hump.

Re: Load Game From Slot - Persistent Scene

Posted: Mon Jan 16, 2023 7:34 pm
by Tony Li
Hi,

There are two ways to handle that currently:

1. Mark the root GameObjects in your Persistent Scene as Don't Destroy On Load. They won't be unloaded when calling SaveSystem.LoadFromSlot(). You can add a Don't Destroy GameObject component to these GameObjects.

2. Or UNtick the Save System component's Save Current Scene checkbox. Handle scene loading yourself. You can still get the last scene the player was in like this (example):

Code: Select all

var savedGameData = SaveSystem.storer.RetrieveSavedGameData(slotNumber);
SceneManager.LoadScene(savedGameData.sceneName);
SaveSystem.ApplySavedGameData(savedGameData);

Re: Load Game From Slot - Persistent Scene

Posted: Tue Jan 17, 2023 7:24 am
by wkjp213
This is great thank you! It's pretty much working perfectly with your second option. I'm not sure why I didn't put that checkbox with the idea of loading the scene but thank you for the clarification.

Loving all your products/engines and the support!

Re: Load Game From Slot - Persistent Scene

Posted: Tue Jan 17, 2023 10:36 am
by Tony Li
Thanks! Glad to help.