Can you explain the order (or tree) of nodes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheVorkMan_

I don’t understand how this is made.
Can you explain how I can change the order in script?
I’m say about this:
Tabs - Scene, Import. This is SceneTree, right?

:bust_in_silhouette: Reply From: Cyber-Kun

could you elaborate more on what it is you wish to accomplish?
if you just want to move a node around it’s pretty easy

for the example I’m going to use the image you’ve attached to the question

say if you wanted to move Label from world-group to render-group

you get a reference to the world group and the Label

var LabelToMove = $World/world-group/Label
#then remove the child label from world-group
$world-group.remove_child(LabelToMove)
#add it to world/render-group
$World/render-group.add_child(LabelToMove)

also when you remove the child with remove_child() it is still in memory that’s why you can just add it wherever you want again and in fact you should be able to add it multiple times if you wanted

but if you want to remove it in one function and add it in another make sure to use a global variable to store the object. or just pass it in as an argument for the function that adds it back to the scene tree

if you completely want to remove the object from memory you can reference it and call the .free() function