0 votes

Loaded a scene as packed scene and instanced it. Kept the instance in memory as a member variable of a superior scene for subsequent access.
Added it to tree: entertree() and ready() are called as expected. Then removed it from tree, but kept instance. In subsequent adding the instance to the tree _ready() is not called any more, but _entertree is. This is not as the doc describes for _ready(): "Called when the node is ready, i.e. when both the node and its children have entered the scene tree".

asked Mar 1, 2018 in Engine by Maxpilot (60 points)

1 Answer

0 votes

Yes _ready() should be only called when added to tree and all of its children are ready as well.
when instancing, _init() is called instead. Where instance() is the analogous behavior of new(), but for packed scenes.

Double check if you're really not getting that behavior. If that's really not the case, then consider filing a bug report.

answered Mar 1, 2018 by Guilherme Furst (55 points)

Hi,
thanks for answer. Don't know if this is a bug or for whatever reason intended behaviour. Here a little project that breaks down what I mean. If run in the editor, the results can be seen in the console:

Test

Just in case anyone runs in the same: Got an answer on Github that this is intended behaviour. "requestready()" (I put this in _entertree() function) will do the trick.

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 How to use this Q&A? before posting your first questions.