The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+4 votes

i have this script to make a list of player's unit and enemy's unit, every time a unit is spawn or destroyed this function run again to update the list and reconnect the signals but...

func set_targets()-> void:
var nodos:Array = get_children() 
for element in nodos:
    if element.is_in_group("player"):
    if element.is_in_group("enemy"):
        lvl_top_score += element.score
for element in player_units:

i keep getting this error:

E 0:00:27.932   connect: Signal 'enemy_unit_destroyed' is already connected to given method 'handle_destroy_enemy' in that object.

Method failed. Returning: ERRINVALIDPARAMETER
core/object.cpp:1512 @ connect() @ settargets()
dev @ _onTimer2timeout()

so i want to check if they are already connected. But i don't find the way.

Godot version V3.4
in Engine by (81 points)

-.-U !!! Sory: i just found it, the function is:

bool is_connected(signal: String, target: Object, method: String) const

"Returns true if a connection exists for a given signal, target, and method."

i will leave this question for anyone else looking for this, (i didn't find anything when i was looking for it)

Please log in or register to answer this question.

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.