This._scene is null (FF)/Cannot read properties of null (edge)

Hello babylon.js community!

This is my first post here, because I am running into an issue with the babylon library. (I am new, so be gentle!)

Cannot read properties of null (reading ‘getUniqueId’) (edge
this._scene is null (Firefox)

Attatched is evidence, and the repo for my project is here: NodeMixaholic/Engineish2: RLua-like JavaScript game engine in the web. (github.com) (It’s supposed to be like an easier wrapper around Babylon specifically made for making video games).

I hope yall have a good time, whatever time it is for yall.

PS: evidence is below.
foxlike


)

Hi!

That is probably because you are creating Instance ( Engineish2/eish2.js at main · NodeMixaholic/Engineish2 (github.com)) before you are creating the scene ( Engineish2/eish2.js at main · NodeMixaholic/Engineish2 (github.com)). Instrance’s constructor is creating babylon objects and require the scene variable to be already initialized. It’s valid javascript, but it’s not the right timing.

My only recommendation to you is to clean up your code, and make sure you always pass the right variables to the function instead of trusting global variables to be initialized.

And welcome to the forum! Always ncie to see new babylon users :slight_smile:

1 Like

Hi @NodeMixaholic just checking in, did Raanan’s answer solve your problem? :slight_smile: