Godot Instanced Scene's name cant be accessed

Godot version

4.3

Question

I am making a game, and when switching to a new level, the old one is supposed to get deleted. The level is a child of “$active_level” and is always called “level”. Now when the gameover screen, which is opened the same, is supposed to get deleted it throws an error saying that it cannot call “.queue_free()” on a Null Instance. the level is being nextLevel.name = “level”, which is how every level is forced to being named “level”. The “most parent” node in the gameover screen is also, like all other levels, called “level”. I am really lost here and am out of Ideas
CODE:

I still don’t know why it wasn’t working, so please enlighten me. I just fixed it by deleting the first child of “active level” which is always only the level that is supposed to be deleted.

add_child does not guarentee the name will be kept, you can check the running scene tree by playing the game, and selecting “remote” in the scene tab.

1 Like