Topic was automatically imported from the old Question2Answer platform.
Asked By
teedoubleu
Old Version
Published before Godot 3 was released.
If I want to find a node by its name I usually do get_tree().get_root().find_node(), but it doesn’t work for instanced scenes, even if they are placed in the tree in the editor.
Whats the reason behind making it to work like that? I often create new scenes from branches of the main scene and suddenly all code dependent on find_node() stops working because its not a node I’m looking for, but an instanced scene.
First of all, try to use Remote Inspector to see what scene tree actually is made.
then I guess, you can see the name of instanced node is something like @block@155 like screenshot above.
you should set a specific, non-conflict name to instanced node if you want to find it by find_node
if you set it as same name with another which is already in scene tree and same depth, it will be renamed to something unique.
só para complementar. Assim que você faria para mudar o nome: