Navigathena icon indicating copy to clipboard operation
Navigathena copied to clipboard

[FEATURE] OnUnload or a way to know if the scene will be unloaded in OnFinalize

Open SoraTehk opened this issue 3 months ago • 3 comments

Feature destription

So I have a problem when I'm:

  • Preloading assets with OnInitialize
  • Releasing them in OnFinalize ...for a persistent scene, in which it OnFinalize also get called when pushing in a new scene

SoraTehk avatar Sep 15 '25 05:09 SoraTehk

Can you provide more details?

mackysoft avatar Sep 15 '25 05:09 mackysoft

Wait, I'm sorry, I misunderstood the package. It seems like Navigathena doesn't support additive scenes. I thought:

  • Push/Pop: Doesn't unload the previous scene
  • Change: Unloads all scenes and loads the target scene
  • Replace: Unloads the top scene and loads the target scene
  • Reload: Reload head scene (keep all previous scene intact)

Based on that, how would you handle additive scenes? Should I just use Unity's built-in SceneManager? Because if I do, I will lose Navigathena's lifecycle events.

SoraTehk avatar Sep 15 '25 07:09 SoraTehk

I just realize, in my Splash scene:

await Addressables.LoadSceneAsync("Levels/Core/Core.unity");

And on my Core's ISceneEntryPoint.OnEnter

GlobalSceneNavigator.Instance.Change(new AddressableSceneIdentifier("Levels/MainMenu/MainMenu.unity"));

This code unload my Core scene, is this normal behaviour?

SoraTehk avatar Sep 15 '25 08:09 SoraTehk