Help with error after `launch`ing a scene that has been `stop`ped

Thanks for taking a look at it. I managed to figure out the issue.

I put some console logging in and noticed that the error I was seeing got printed out prior to the create function being called in the UiScene. So I thought it had something to do with a registry event listener, and that ended up being right.

Turns out, I was assuming that my scene’s destroy method would be called when I called stop on the scene plugin. But that’s not the case. Which meant the code turning off the listeners for the registry events in the UiScene was not getting called, and they were trying to update Text objects that no longer existed. I’m not sure why this manifested in a weird speed up in the game, but it did. When I made sure that those listeners were turned off, then everything was fixed.

What I learned is that the scene doesn’t get destroyed on a stop call, but it does get shutdown. So I added an event handler for the shutdown event in my ui scene and made sure to clean up those registry listeners that updated the text objects, and that fixed it!

Thanks for the extra eyes @B3L7, much appreciated.

2 Likes