Hello !
Not sure either it should go into Bugs or Feature requests (or none of them, if it’s known)
- Some constructors need the
scene
as param :
const transform = new BABYLON.TransformNode("transform", scene);
const ground = BABYLON.MeshBuilder.CreateGround("ground", {width: 6, height: 6}, scene);
const camera = new BABYLON.ArcRotateCamera("camera", 0, 1, 10, BABYLON.Vector3.Zero(), scene);
- If not provided, the scene will be retreived automatically
- If the scene doesn’t exist, it will trigger this error (PG repro) without any warning :
TypeError: Cannot read properties of null (reading 'getUniqueId')
at t.e (node.ts:358:37)
at new t (transformNode.ts:188:14)
at createScene (<anonymous>:6:23)
at window.initFunction (<anonymous>:51:16)
at async R._compileAndRunAsync (rendererComponent.tsx:344:17)
I know that these constructors should not be used before the scene creation, and also I’ve seen is this topic that a NullEngine can be used for specific needs without a scene.
But still I think that this should be given as a warning in the console. The error is not obvious, and in my case, after some file structure changes in a project I ended up with such call before scene creation, and I have lost quite some time figuring out that the problem was just a misordering of scene creation and mesh creation…