Condition "!is_inside_tree()" is true. Returned: false

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

Hello, I am creating a room like the binding of Isaac

call_deferred(remove_child, …) and call_deferred(add_child, …) to change the room every time the door is opened.

But even if I check the remote, there is nothing wrong, but this error pops up in the debugger.

[Condition “!is_inside_tree()” is true. Returned: false]

I wrote the above mechanism by loading the instance stored in the Level1 scene room array from Door.gd.

Sorry to my awful English, Thank you.

:bust_in_silhouette: Reply From: klaas

Hi,
this looks like you are doing something with the object before it is in the tree.

If you create an instance and add it via add_child you have to wait unitl it signals “ready” to actually be sure it is initialized correctly.

signal “Ready”!

I wasn’t thinking about the signal in the first place. Thank you!

HorseGorilla | 2021-07-23 21:22