Godot Version
4.3
Hello again ! Another noob question : how to access a node (named “Lights”) on the root-scene ? I cant use a relative path like …/Light because the node needing access to the other node wont always be on the same level, sometime it will need access to a sibling but sometime it will need access to the sibling of a parent node. For this I need to have a semi absolute path. I say semi absolute because the root scene wont always be named the same.
I know how to access the root node using get_tree().current_scene, but I can’t figure out the proper syntax to access one of it childs ???
get_tree().current_scene/Lights. ?
Thank you !
Edit : I found a way just before posting this so I’ll write it and still post this because the answer is hard to find… at least for me lol !!
So the proper syntax is to use get_node after get_tree like this :
get_tree().current_scene.get_node(“Lights”).visible = false
In this case I want to set visible to false on the node “Lights” which is directly in the root scene.
And a little more context : Lights is a node containing all the lights nodes on my level but I want to access it from a few switchs that can be either directly in the level node or in a room node inside the level node. At least it makes sens to me… lol