- Edited
Hi! (I think) I ran into some issues where child nodes aren't quite ready yet when the parent wants to do some stuff, so I'm trying to yield
until they are.
Now I have a weird situation with yield that's waiting for a ready signal. With a node that's already in the scene tree it works:
var node = get_node( myNodePath )
yield( node, 'ready' )
print( node.name, ' is ready' ) # <--- all good, this gets executed after the node's _ready
However, if I create a node by instantiating a PackedScene the ready signal doesn't seem to fire, or yield just can't hear it.
I do add it as a child to the current scene because it seems that this needs to happen to run the node's _ready
function.
var node = myPackedScene.instance()
add_child( node ) # <--- I do see the new node in the scene
yield( node, 'ready' )
print( node.name, ' is ready' ) # <--- code execution never reaches here
I tried to add a custom signal to the PackedScene node instead, emit it at the end of _ready
and changed the yield to listen to the custom signal. But it's the same situation, code execution never gets past that yield. It doesn't seem to "hear" the signal from the instantiated PackedScene.