Event Not working after changeScene

After changing the scene (this.app.scenes.changeScene(“theOtherScene”))
The event is not working anymore.

https://playcanvas.com/project/1020484/overview/error
To repeat the problem, Launch Exhibition Menu Scene → Click “art” frame in right side of a door. →
When the scene changed into “Exhibition Sub Menu” → Click a house shaped button in the left side.

This house button is working if the scene “Exhibition Sub Menu” is directly launced. But when it is not
working when it is changed to it from another scene.

-s

Hi @lenvanthis,

When I try your repro steps I get an error on the look-camera.js script (line 137). It seems the code tries to reference the controller script, but the script component is undefined (even though the gaze controller exists).

This seems most likely an issue with how you handle your scene changing code. If you destroy and re-create your camera controller, make sure you remove any input/event handlers attached. This will not happen automatically.

Check this manual page for more info and some good practices on this subject, hope that helps:

https://developer.playcanvas.com/en/user-manual/packs/loading-scenes/

1 Like

Awesome. I will look into this. Thanks a lot!