Gizmos only work in last created scene

Hey, I’m creating two scenes and only the second one shows Gizmos. Meaning if I select something with Gizmos turned on in my first scene I only see the Gizmos in the second one.

Idk how to reproduce that in a playground. Hopefully you can easily check on what I mean.

The gizmo layer (a variable passed when constructing a gizmo) Is a reference to the utility layer that will render the gizmo. A utility layer is constructor for a specific scene. The default one is created for the last available scene:

    /**
     * A shared utility layer that can be used to overlay objects into a scene (Depth map of the previous scene is cleared before drawing on top of it)
     */
    public static get DefaultUtilityLayer(): UtilityLayerRenderer {
        if (UtilityLayerRenderer._DefaultUtilityLayer == null) {
            return UtilityLayerRenderer._CreateDefaultUtilityLayerFromScene(EngineStore.LastCreatedScene!);
        }

        return UtilityLayerRenderer._DefaultUtilityLayer;
    }

You can create your own utility layer, attached to the right scene, and pass it to the gizmo. You can read about it here - Rendering Utility Layers | Babylon.js Documentation

2 Likes