0 votes

So the problem is I want to connect signal of a child node to the parent node script.
But my code seems not working if I want to connect the signal like the code below.

enter image description here

So I have to go to the parent script node to connec it.

enter image description here

My question is why? Is it because .connect() function can't see cross node? Like in this case || .connect("levelselected", self, "playselectedlevel") || the thid arguments || "playselected_level" || must be found in the same script as .connect()?

Godot version 3.5.1
in Engine by (61 points)

Are you getting an error message or is the signal handler not being called? FYI: get_tree().call_group I beleive does a call_deffered of the given function, so that might be a source of you bug.

I only get these error. But it's different case, because the error happen after the onselect_level() get called again.

enter image description here

But no. Godot doesn't register the connect function.

Ah.. Wait.. I must put connect signal in the ready(). It cannot in the same function of the _onselect_level().

enter image description here

Yeah after a bit of looking up in the code. The problem seems to be what line being called first.

enter image description here

And it works.. But it will give the error in the first image.

Hahaha even though it's not related you point me to "signal handler not being called" made me realize my mistake though. Thanks.

1 Answer

0 votes
Best answer

Answer and reminder for future me or anyone who reads. The mistake seems to be which line being called first.

enter image description here

.connect() function in the image above is being called way after .emit_signal((). Basicly the signal already deliverd but the address is not in the same time as signal deliverd.

enter image description here

But the code above is not recomended, just put signal connect in the _ready() function.

enter image description here

by (61 points)
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 [email protected] with your username.