Alerts on loadFromSlot

Announcements, support questions, and discussion for the Dialogue System.
cesar101
Posts: 9
Joined: Fri Jul 24, 2020 1:19 am

Re: Alerts on loadFromSlot

Post by cesar101 »

I think i kinda understand how the BeforeSceneChange/LevelWillBeUnloaded works, and as i wrote in the code, im calling it right before the SceneManager.LoadSceneAsync(). Now, im using the MultiActiveSaver with GameObjects that have the IncrementOnDestroy component attached to them, which leads me to think that when the scene starts, the MultiActiveSaver restore the active state of the gameobjects, and therefore the IncrementOnDestroy component reacts to it, how could i avoid that? or the BeforeSceneChange/LevelWillBeUnloaded are supposed to prevent this behaviour?
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alerts on loadFromSlot

Post by Tony Li »

If you're loading the Ingame scene and then unloading the login scene, then the IncrementOnDestroy GameObjects in the Ingame scene shouldn't be getting destroyed at all. What's causing them to trigger?
cesar101
Posts: 9
Joined: Fri Jul 24, 2020 1:19 am

Re: Alerts on loadFromSlot

Post by cesar101 »

Im not destroying the objects, they are just being set to inactive by the MultiActiveSaver. what i have is a GameObject which has a MultiActiveSaver which has reference as objects to watch, to his childs, which each one has an IncrementOnDestroy component. What i believe is happening is that as soon as the ingame scene loads, and i call the LoadFromSlot, the MultiActiveSaver restores the referenced objects to their active states(which would be false in my case), which causes the IncrementOnDestroy objects to trigger, therefore, the alerts pop up.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alerts on loadFromSlot

Post by Tony Li »

Got it. That's an oversight on my part. This patch should address it:

PixelCrushers_ActiveSaverPatch_2020-07-24.unitypackage

Before the ActiveSaver/MultiActiveSaver component sets a GameObject inactive when restoring save data, it tells the GameObject's components to ignore the OnDisable message.
cesar101
Posts: 9
Joined: Fri Jul 24, 2020 1:19 am

Re: Alerts on loadFromSlot

Post by cesar101 »

I imported the pacakge and sadly it didn't fix the issue, could it be that im missing something?
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alerts on loadFromSlot

Post by Tony Li »

Darn it, I had a typo in MultiActiveSaver. ActiveSaver was fine, though. Here's an updated package:

PixelCrushers_ActiveSaverPatch_2020-07-25.unitypackage

Also, make sure to put the Dialogue Manager prefab in your login scene, and add a DialogueSystemSaver to it.
cesar101
Posts: 9
Joined: Fri Jul 24, 2020 1:19 am

Re: Alerts on loadFromSlot

Post by cesar101 »

That did the trick, thanks a lot for your help.
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Alerts on loadFromSlot

Post by Tony Li »

Happy to help!
Post Reply