I want to do some stuff in a node before all the other nodes do their initialization stuff. Namely I want to set up some general resource data that lots of nodes need in a way that they can easily reach it in code.
To set up some data the node that does it needs to go before the other nodes and also needs access to some data in the form of Resources that I have asigned it through an export. Since I need one node to always go first, it would make sense to put the code in the top node in a function that works top down. Init goes first and works top down, but the resources I need from the export aren't ready yet when it's called. Ready goes bottom top, so all the other nodes get called before the top one. Is there any other way to do this or do I need to rethink what I am trying to do here?
When nodes enter the Scene Tree, they become active and receive the _enter_tree()
callback, which executes after _init()
and before _ready()
:
Called when the node enters the SceneTree (...). If the node has children, its _enter_tree() callback will be called first, and then that of the children.