# Add console warning when no scene found while needed

**URL:** <https://forum.babylonjs.com/t/add-console-warning-when-no-scene-found-while-needed/57313>\
**Category:** Feature requests\
**Created:** [March 20, 2025, 3:19pm UTC](https://forum.babylonjs.com/t/add-console-warning-when-no-scene-found-while-needed/57313 "2025-03-20T15:19:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [March 20, 2025, 3:19pm UTC](https://forum.babylonjs.com/t/add-console-warning-when-no-scene-found-while-needed/57313/1 "2025-03-20T15:19:04Z")

</div>

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 :

```javascript
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](https://playground.babylonjs.com/#4U4QH9#287)) without any warning :

```auto
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](https://forum.babylonjs.com/t/create-mesh-without-scene-to-access-computeworldmatrix/24920) 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…

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 20, 2025, 4:33pm UTC](https://forum.babylonjs.com/t/add-console-warning-when-no-scene-found-while-needed/57313/2 "2025-03-20T16:33:30Z")

</div>

I’m game!
