Page 1 of 1
Question about active saver
Posted: Mon Jul 14, 2025 8:21 am
by Lucian1899
Hi,
I have an UI canvas in my first scene and set it as DontDestoryOnLoad,it has several layers and many child objects, and I add an active saver component to it. During the game, some of its child objects will become active, but here comes the save problem.
I use On Conversation End trigger to activate those child objects, their active state can be saved when I change sences, S/L, back to main menu(only in play mode).but when I back to edit mode and play the game again, I found their active state can not be saved when I load the game. Could you please tell me which step I did wrong, or I missed something? Thank you!
Re: Question about active saver
Posted: Mon Jul 14, 2025 8:47 am
by Tony Li
Hi,
ActiveSaver and MultiActiveSaver components must be on GameObjects that are active when the scene starts. Is your ActiveSaver component on a GameObject that is active when the scene starts?
When you enter play mode a second time, are you loading a saved game? The save system will not automatically restore your last saved game. You can use an AutoSaveLoad component to do this, or you can load a saved game manually using the C# method SaveSystem.LoadFromSlot(#) or SaveSystemMethods component.
Re: Question about active saver
Posted: Mon Jul 14, 2025 9:04 am
by Lucian1899
Hi,
ActiveSaver and MultiActiveSaver components must be on GameObjects that are active when the scene starts. Is your ActiveSaver component on a GameObject that is active when the scene starts?
Yes, the father object is active when the scene starts.
When you enter play mode a second time, are you loading a saved game? The save system will not automatically restore your last saved game. You can use an AutoSaveLoad component to do this, or you can load a saved game manually using the C# method SaveSystem.LoadFromSlot(#) or SaveSystemMethods component.
I think I loaded a saved game, I'm using the Dialogue System Menu Framework. Here are my menu system and dialogue system, I don't know if I did something wrong, thank you!
Re: Question about active saver
Posted: Mon Jul 14, 2025 2:30 pm
by Tony Li
How are you changing scenes? Please see
How To: Change Scenes With Save System. See also:
How To: Manage Player Controls and Scene Changes.
When you're in the main menu scene, are you using the "Load Game" or "Continue" buttons to load a saved game?
Re: Question about active saver
Posted: Tue Jul 15, 2025 8:04 am
by Lucian1899
Hi,
How are you changing scenes?
I use PixelCrushers.SaveSystem.LoadScene("sceneName").
When you're in the main menu scene, are you using the "Load Game" or "Continue" buttons to load a saved game?
Yes, I use LoadGamePanel.LoadCurrentSlot() and SaveHelper.LoadLastSavedGame.
I've tried to watch a regular GameObject's active state in another scene, and it can saved perfectly. So I think maybe the UI canvas itself has the problem. Here's my custom persistent singleton script, I'm not sure if it is correct and related to this problem.
Code: Select all
using UnityEngine;
public class DontDestroy : MonoBehaviour
{
private static DontDestroy instance;
private void Awake()
{
if (instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
}
And actually, the UI canvas is using this Dynamic Panel,
https://github.com/yasirkula/UnityDynam ... me-ov-file, so I'm not sure if I should customize that Dynamic Panels Canvas script, or I should write a custom saver? Thank you!
Re: Question about active saver
Posted: Tue Jul 15, 2025 9:01 am
by Tony Li
Hi,
Is it possible that the ActiveSaver or some other component is losing its reference to the Don't Destroy On Load GameObject? Please see the How To: Manage Player Controls and Scene Changes link above for an explanation of how this can happen and how to address it.