Skybox dissapears when changing scenes

Hi all,

I’m having an issue whereby when I change from one scene to another, the skybox (in the second scene) is not there.

I only have 2 scenes in my project, a menu scene (which does not use a skybox) and a ‘game’ scene, each has a button/sphere that changes scenes to the other.

Interestingly, if I load up the ‘Menu’ and change to the ‘Game’, the skybox is not there, however if I load up the ‘game’ scene directly it all works fine.

Here is the link to my project - https://playcanvas.com/editor/scene/497344 - the scene switching code is attached to the sphere object.

Many thanks,

Matt

Hello,

I’m having the same kind of issue.

Here is my small test case https://playcanvas.com/project/766014/. I’ve a Main scene with no skybox and on click on the cube, I change to an other scene with a Skybox, it isn’t displayed.

On a bigger project, from one scene to an other scene I’ve also some missing objects which are in Batch Group. What I’m missing?

Hi @Aymeric, i just tried to reproduce the issue in your project but the skybox is displaying on changing scenes.

1 Like

Indeed @saif, thanks for the lookup by the way, I just changed for loadScene instead of loadSceneHierarchy.

It seems to properly switch full scene the code is :

var oldHierarchy = this.app.root.findByName ('Root');
    
// Get the path to the scene
var scene = this.app.scenes.find(sceneName);

// Load the scenes entity hierarchy
this.app.scenes.loadScene(scene.url, function (err, scene) {
    if (!err) {
        oldHierarchy.destroy();
        pc.ComponentSystem.initialize(scene.root);
        pc.ComponentSystem.postInitialize(scene.root);
    } else {
        console.error(err);
    }
});

From https://developer.playcanvas.com/en/tutorials/switch-full-scene/.

1 Like