Use "Node" as in-hierarchy "folder" (is it ok?)

Godot Version

4.5.1

Question

Hey!
It is very natural for novice Godot users, such as myself, to use the class Node (the grey one, not Node3D) as a sort of in-hierarchy “folder” in a scene.

Since it doesnt have anything, not even a position in the world. However - for some reason it concerns me a bit.

Is it strongly advised to absolutely NOT do this?

Using the base Node type could be bad, it breaks the transform between your Node3Ds. If you move the “World” node then your player, world light, editor tools, scrap spawn, and terrain will move, but the other objects will not, because they are children of a Node.

You should probably use a Node3D instead, even if in this example you do not intend to transform the root World node. On rare occasion it can be useful to break this transform chain.

3 Likes

yeah i totally get it. I wish that there was a folder like “thing” for hierarchies that just acts as a way to tidy up things.

I’ll use a Node3D. Thanks

2 Likes

You can attach to your “folder” nodes an “_on_ready()” script that reparents all their children to their parent node then frees the “folder” nodes, so they would only exist in the editor, but at runtime all your nodes would be reparented to your world node.
I do that in some cases, though it might be unnecesarry..

1 Like

No, it’s totally fine to do that. But as already stated: Make sure to use Node2D/3D where appropriate.

Although at some point you might want to think about separating your sub-hierarchies into their own scenes.

1 Like

The bigger question is are you planning on ever moving the World node?
In fact the way you are using Node in your post is the recommended method.
I posted in a feature request to add a editor only title or region and was informed that using a Node was the way to do it.
You can find that discussion here.
And after trying it out, I have no problem using Node for this. Just be aware of the issue gertkeno points out.

I specifically use Node objects when I don’t want things to be attached to coordinates. However, I would strongly recommend you use Node3D (or Node2D in a 2D game) nodes for your environment and visible objects in your environment..

3 Likes

thanks all. I’m obviously going to NOT use Nodes for “folders”. I’ll convert to node3D ----------- simply because that feels more right.

1 Like