Hi All,
I was debugging an issue in my application and noticed something strange.
Even though the last scene I created was my main applicationScene, because Babylon’s GizmoManager
creates a new _VirtualScene
for BoundingBox
, the EngineStore.LastCreatedScene()
will change (as shown here)… which causes issues downstream.
Several constructors in Babylon offer scene as an optional param
-
BABYLON.Inspector.Show(scene?)
// Scene is optional -
new BABYLON.Mesh(scene?)
// Scene is optional for everything that extends Node
If the optional param is empty they will default to EngineStore.LastCreatedScene
this._scene = <Scene>(scene || EngineStore.LastCreatedScene);
If we can guarantee LastCreatedScene
points to the last scene the user created (not a scene created by Babylon), this defaulting logic should be true for most scenarios