I’ve a PlayCanvas default loading screen (with a customized loading.js) and a world map with 3 destinations, let say A, B, C. When selecting a destination, I’ve a loading scene then the destination scene.
window.top.location.href // watch current/requested url
window.history.pushState // rewrite url
document.referrer // see from where user is coming
But as far as I know, I can’t prevent to load the map scene first since it’s my primary scene. Unless I deeply change the loading.js for moving out directly in the app.on('preload:start'? But since there are many assets with preloaded checked, this might lead to many bugs when coming back to the map. Is there any examples?
That’s a good question. And you are right, for editor based projects, you can’t really change the first scene that loads.
If you are ok with hosting the build yourself, then you can easily add your scene selection logic to the __settings__.js file. That’s where the global var SCENE_PATH is being set, which you can override (that’s not a JSON file, it’s regular JS so you can add code):
That change will automatically be picked up by the __start__.js script, so no further changes are required.
The way I would work around this is have an almost blank starting scene that only has a script to load the correct scene based on URL parameters and will fire a custom app event once the real scene is loaded.
The loading script will be modified so it only hides the splash on the custom app event.
Leonidas method is better as it avoids and extra load.