0 votes

So, I've got the following code inside my script:

    for i in multiples_ids:
    var multi = instance_from_id(i)
    multi.connect("not_touched", self, "multi_is_untouched(multi)")

func multi_is_untouched(multi):
if multi.get_node("Area2D").overlaps_area($Hole3/Area2D):

However, when the multi object emits the signal "not_touched", nothing happens.
I can see this error in the debugger:

emitsignal: Error calling method from signal 'nottouched': 'Node(Main.gd)::multiisuntouched(multi)': Method not found..
<C++ Source> core/object.cpp:1242 @ emitsignal()
Multiple.gd:29 @ _unhandled

Since I have 3 multis instantiated, I find it important for the movemultito_respos() function to have a reference to the multi emitting the signal. (I could make a workaround in case the signal can't pass the argument through the function, though)

Any advice?

Godot version 3.5
in Engine by (44 points)

1 Answer

+1 vote
Best answer

Change this line

multi.connect("not_touched", self, "multi_is_untouched(multi)")


multi.connect("not_touched", self, "multi_is_untouched")

Where in your script multi emits the not_touched signal, use:

emit_signal("not_touched", self)

And when the not_touched signal is defined, replace it with

signal not_touched(multi)

When you connect the signal to the function, it will automatically pass the required parameters.

by (731 points)
selected by

Worked perfectly. Thank you very much!

Happy to help :)

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.