($50 reward ) Script error with default VR scene when jumping back in

Edit: $50 reward will be sent via PayPal to whoever gets the issue fixed first.

I have a simple test project using a slightly modified version of the default VR scene ( select jumps to new scene in box.js ), where the new scene is a duplicate of the VR scene. When jumping back to a previously loaded scene, an error occurs.

You can test and see this bug in a non-VR environment :slight_smile:

Here’s the link to the project showing the issue…
https://playcanvas.com/project/541841/overview/vr-project-scene-swapping-issues

If you hover over the box for a few seconds, the next scene loads. If you then hover over that box to load the original, you’ll get this error…

[playcanvas-stable.dbg.js:606]: Unable to get property ‘selectorcamera:select’ of undefined or null reference
TypeError: Unable to get property ‘selectorcamera:select’ of undefined or null reference
at pc.events.fire (https://code.playcanvas.com/playcanvas-stable.dbg.js:606:19)
at SelectorCamera.prototype.update (https://launch.playcanvas.com/api/assets/files/scripts/selector-camera.js?id=11517791:54:21)
at _scriptMethod (https://code.playcanvas.com/playcanvas-stable.dbg.js:23262:7)
at _onUpdate (https://code.playcanvas.com/playcanvas-stable.dbg.js:23299:9)
at _callComponentMethod (https://code.playcanvas.com/playcanvas-stable.dbg.js:23526:7)
at _onUpdate (https://code.playcanvas.com/playcanvas-stable.dbg.js:23536:5)
at pc.events.fire (https://code.playcanvas.com/playcanvas-stable.dbg.js:608:5)
at update (https://code.playcanvas.com/playcanvas-stable.dbg.js:21310:7)
at Application.prototype.update (https://code.playcanvas.com/playcanvas-stable.dbg.js:20861:5)
at Anonymous function (https://code.playcanvas.com/playcanvas-stable.dbg.js:21210:7)

And here’s an image show the debug trace…

And here’s a link to a project where I’m testing some fixes ( cleaning up on the destroy event )

https://playcanvas.com/project/541842/overview/vr-project-scene-swapping-2

If you can help get this resolved, we can get the changes put back into the original default VR project so that it’s fixed for the next person.

There are no issues with jumping between different scenes ( tested with several in a row ), it’s jumping back to a previously loaded one that is causing the issue.

Mal

Solved - I had a quick look ( waiting on Unity to build an Android app, takes ages! ), and have done it a slightly different way. I set an overall flag to load the level, and then on Update I run the code to load the next level.

I’ve set that scene up to run the lightmapper.bake() after loading, but the lighting seems a LOT different from the lighting that occurs within the editor. I’ll try to get more time on this, and will do a separate post about it if I can’t find out why.

https://playcanvas.com/project/541842/overview/vr-project-scene-swapping-2

Here are some screenshots showing the difference between the two levels in the editor, and them after runtime lightmapper.bake()

From…

to…

From…

to…