Reply To: Avoiding null reference exceptions when changing scenes

Forums 💬 Slate Sequencer ⚙️ Support Avoiding null reference exceptions when changing scenes Reply To: Avoiding null reference exceptions when changing scenes

#20340
Gavalakis
Keymaster

    Hello again,

    Indeed, you should make sure the the cutscenes are stopped before loading another scene. Your code should work fine and I guess that this should be handled automatically, but the problem is that there is no Unity callback that actually fires off before another scene is loaded (and before the objects are destroyed). I’ve tried SceneManager. sceneUnloaded and it doesn’t really fir the bill. There is also stop and cleanup code in the Cutscene.OnDestroy, but as usual, OnDestroy in Unity, is called 1 frame after objects are actually destroyed.
    As such I really think that what you are already doing is a good solution 🙂

    Thanks!