.instance() isn't waiting for node's _ready()?

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

I have “main” function for the CanvasLayer.


So, problem is in null-instanced “onready var”. All of it is null:

new_container’s function:

Why .instance() isn’t waiting for the full loading of scene and how to wait for it?

:bust_in_silhouette: Reply From: exuin

_ready() is not called until the node is in the scene tree after add_child is called. You need to add the node to the tree before calling the function.

Nope, that’s doesn’t work.
Btw function called by signal.
I’m tried to make an instance and pass into it, but no. Instance was made in _ready() of CanvasLayer and stored in variable, but still no.

-Mappleaf | 2021-09-24 10:28