I’m trying to implement a custom loading solution for a multi scene application.
First thing I’m doing is caching all scene files with loadSceneData
and parsing assets needed for the scene:
pc.app.scenes.list().forEach((sceneRegistryItem) => {
pc.app.scenes.loadSceneData(sceneRegistryItem, (err, sceneRegistryItem) => {
if (err) {
console.error(err);
}
window.assets[sceneRegistryItem.name] = [];
window._parseSceneAssets(sceneRegistryItem.name, sceneRegistryItem.data);
});
});
Sometimes this has the effect of loading another scene than the scene I pressed play in the editor.
I’m guessing this is some kind of race condition, as I couldn’t find a way to consistently reproduce this.
Steps to reproduce:
- Goto Testproject
- Launch scene
Blue
- Press F5 until different scene is loaded (Cubes are color coded with scene name)
For me it did occur more often, when I have dev tools opened.
I also have a different project, where the bug occurs more often. I think it has to do with more assets needing to load/custom load script. However it’s a private project. I can add someone tho to get access if needed.
EDIT: Does not seem to happen, when downloaded as zip and opened locally.