When exactly is _Ready called?

Godot Version

4.4.1 on Windows

Question

I know that ready is called after the node and all its children have entered the tree and after all children have called ready.
My question is when I instantiate a scene in code and add it to the tree will the scene be ready by the next line of code or will the scene be added to some kind of list that will be processed in the next frame?

Here is what I am trying to do:

Node currentNode = currentScene.Instantiate<Node>();
if (currentNode is Persistent currentPersistentNode)
{
    GetNode(nodeData["parentPath"].ToString()).AddChild(currentNode);
    currentPersistentNode.Load(nodeData);													
}

I am first instantiating a scene then adding it to the tree then calling load on the node of the scene.
Is it Ready by the time load is called?

Thanks for the help!

Ok so from my debugging it does seem like ready is called as part of AddChild so the nodes are ready immediately.

My problems were stemming from when I was freeing the old nodes before loading the new nodes. I used QueueFree which does not free immediately so i replaced it with Free

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.