'Game' is kind of a reserved node name

Godot Version

4.3.stable.mono

Don’t name the root node of your scene ‘Game’

I could not find this explained anywhere else (either it does not exist as explicit information or my google powers are lame).
The docs say the following about the node names:
(Node — Godot Engine (stable) documentation in English)
“The name of the node. This name must be unique among the siblings (other child nodes from the same parent). When set to an existing sibling’s name, the node is automatically renamed.”

So, here it is.

In the scene you are running, if your top-level node is called ‘Game’, the hierarchy tree breaks.

My Case:
I am restarting a small project (as an easier way to refactor and declutter it) and immediately I got a problem.

Here is the three of the old version and then the new one:
Screenshot 2024-12-28 115357

Screenshot 2024-12-28 115438

The scene in both cases is the one that is run by default.

For the sake of clarity and newness, I decided to change the main node from ‘Map’ to ‘Game’.
I immediately ran into a problem.

I have a global script, designed to set up everything.
First thing in _ready() is a refererence to the TileMap.
Screenshot 2024-12-28 120413

In the new project is just returned null for tile_map.

After quite a while, comparing everything piece by piece between the old (working) project and the new one, I found this - see the same trees (old and then new) viewed as Remote in runtime:
Screenshot 2024-12-28 120746

Screenshot 2024-12-28 120813

It turns out that when you run (at least in debug), Godot creates a ‘Game’ node and that causes conflict of names. As the node in question is the main in the hierarchy, it has a sibling with the same name, so it gets renamed to ‘@Node2D@3’.

So you need to use a different name.

I hope that this may help someone at some point. Remote/Local are available options only at runtime, so I was stuck with the problem for a good three hours myself, before I noticed then and checked what’s happening under Remote.

P.S.
For the sake of completeness, I tried leaving the main node ‘Game’, then finding it by it’s name after renaming (‘@Node2D@3’) and it works. I just had to check.

1 Like

That is a useful tip!

I just checked an older project and my scene’s node is indeed named “Game”. It has no problems during runtime, and there isn’t a second “Game” node created by Godot.

Are you sure this isn’t something specific to your project? Do you maybe have an AutoLoad called Game?

2 Likes

This appears to be false and instead be specific to your project. You probably have an autoload called “Game” which leads to the engine creating this Node.

Also just as a tip there are better ways to get node references then your presented way of doing so

1 Like

Yes, I do!

So that’s why the Game Node appears at runtime…

Thanks.

OK… I feel this post is now more distracting than useful (due to my inforrect feeling I understood what’s happening)
I’ll amend it later to actually be truthful at least (unless I find it easier to remove the post, may be; I hate littering the space).