More info on tree_exiting ?

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

In Node signals there is tree_exiting - Node — Godot Engine (latest) documentation in English

I assume that when ‘exiting’ the node is still inside the tree, and thus will have access to position and other variables, is that correct? What else should I know about when using this signal?

:bust_in_silhouette: Reply From: Zylann

The doc says:

Emitted when the node is still active but about to exit the tree. This is the right place for de-initialization (or a “destructor”, if you will).

So like you said, it is emitted when the node is about to exit the tree but is still inside it. Other implications depend on what you are trying to do in that situation.

Is the difference between it and _Ready just that ready is called once on scene load, while enter_tree is called every time node is added to the scene tree?

jarlowrey | 2019-03-08 14:55

enter_tree is called every time the node itself is added to the tree (so accessing children is not recommended), while ready is called once when the scene and its children were added to the scene. ready can be called again if the node is removed and added back to the tree, but only if you request it by calling request_ready() (for which the elusive doc doesn’t say that so I hope I’m right).

Zylann | 2019-03-08 18:40