0 votes

In Node signals there is tree_exiting - https://docs.godotengine.org/en/latest/classes/class_node.html#signals

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?

in Engine by (689 points)

1 Answer

+1 vote
Best answer

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.

by (28,835 points)
selected by

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

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).

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.