With the issues that users have been facing with Scene Loading, I’ve recently updated the project samples to make it easier to switch scenes and even reload the current scene (which some developers use as a ‘reset’).
Check them out here: https://developer.playcanvas.com/en/tutorials/?tags=scenes
All you need to do is add the file load-scene-helper.js
to your project (via asset copy and paste) and call the function:
loadScene("Some Scene Name", { hierarchy: true, settings: false });
This function solves a lot of the common issues that developers have with loading scenes include:
- Where both scenes are loaded at the same time for a frame and
app.root.findByName
finds the ‘wrong’ Entity - Having to find the scene root Entity by name