After changing scene hierarchy and deleting some old scripts that our team didn’t use. I have some problems with switch between scenes. Project drops down like you see on screenshot.
My code to switch scenes copied from official topic, i tried to creating new scenes without any root hierarchy - but it won’t help.
Code example:
loadScene: (sceneName, options, callback, scope) => {
// Find the Scene Registry Item by the name of the scene
var app = pc.Application.getApplication();
var scene = app.scenes.find(sceneName);
if (scene) {
// Check if the scene data is already loaded, if it is we should assume
// that it stay cached after we loaded the scene and added the
// entities to the scene graph
var wasSceneLoaded = scene.loaded;
try{
app.scenes.loadSceneData(scene, (err, scene) => {
if (err) {
console.log(err);
if (callback) {
callback.call(scope, err);
}
} else {
var sceneParent = null;
// Destroy all the entities on the app.root to completely remove
// the existing scenes
var rootChildren = app.root.children;
while (rootChildren.length > 0) {
rootChildren[0].destroy();
}
// As we've already loaded the scene data, the callbacks for these
// functions will be called immediately
if (options.settings) {
app.scenes.loadSceneSettings(scene, function (err) {
if (err) {
reject(err);
callback.call(scope, err);
}
});
}
if (options.hierarchy) {
app.scenes.loadSceneHierarchy(scene, async function (err, parent) {
if (err) {
reject(err);
if (callback) {
callback(err);
}
} else {
sceneParent = parent;
}
});
}
if (!wasSceneLoaded) {
app.scenes.unloadSceneData(scene);
}
if (callback) {
callback.call(scope, null, sceneParent);
}
}
});
}catch(e){
if(callback) {
callback.call(scope, e);
}
}
} else {
if (callback) {
callback.call(scope, "Scene not found: " + sceneName);
}
}
}