I’m currently experiencing an error in my game. When my character collides into the dumpster asset (rigidbody) it should destroy the current scene and load the assigned scene, but there’s an error that says “Cannot read properties of null (reading ‘element’)” and “Uncaught TypeError: Cannot read properties of null (reading ‘destroy’)”. It’s weird because it was working a while ago.
I would highly appreciate if someone were to help me
First of all, I’m curious why you don’t use the new method to change your scene? You basically only need the line of code below.
this.app.scenes.changeScene('Some Scene Name');
The errors are probably related to the events you create. If you create an event .on you have to make sure you also remove the event .off, for example if you destroy the entity when you change the scene.