Difference between _enter_tree() and _ready()

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

I understand that the _enter_tree() function is called when a node enters the scene tree and while this node is inside the tree, the child nodes of this node have not yet entered the active scene. While of the _ready() function I understand that it is called after the call to the _enter_tree() function and ensures that all child nodes have entered the scene tree. The thing I want to understand more though, is the scene “active” when I press “play”? And then the root node of a scene enters the scene tree when play starts? Could you please clarify these concepts for me? I’m a bit confused about this

You’ve also managed to confuse with your confusion.
When you say “active” what do you mean?

The scene tree follows the basic point tree structure and is Traversed as Root > Parent > Child > Leaf

Wakatta | 2021-09-05 15:25

Consider the following

for node in sceneTree:
    node.init()

for node in sceneTree:
    node.enter_tree()

for node in sceneTree:
    node.ready()

If you want it to operate in a different way you can also write your own main_loop

Wakatta | 2021-09-05 15:29

I didn’t understand it the way you didn’t. I actually read from here: the overridable functions
https://docs.godotengine.org/en/stable/getting_started/step_by_step/scripting_continued.html#overridable-functions

Peppe | 2021-09-05 15:40

What is it exactly that you are trying to accomplish?

Wakatta | 2021-09-05 17:10