0 votes

I have many nodes which I want to connect to the same signal, but as said, it's many and I dont want to do it manually.
I know some ways in gdscript like:

for child in parent:
child.connect.....

but in my scene the nodes I want to connect is not the only children

and

for nodes in get_group....

but that way I should sign in a group to each of them, which is almost connect signals manually.

Could anyone help me?

Godot version 3.4.2
in Engine by (21 points)

1 Answer

+1 vote
Best answer

You have various nodes in various places... and how do You expect editor to get into your mind and know which particular nodes You want to connect ??
You have to at least find some common feature all of those nodes share and which is characteristic for them. Are they in the same folder ? Do they extend one class ? Do they share childed nodes ? Are they created by one particular object ?

by (7,925 points)
selected by

Perfect, you are right, I should've clear this first.
The common feature they have is: they are several instances of the same inherited scene.
I dont know if I got to be clear, but if I did, do you know a way to do that?

This is lucky. This way You can connect manually original scene, and all its inheritants will become connected as well.

I used this scene in others scenes, and each of them would have a different comportament to the signal. But you gave me the idea to add the original scene to a group and then connect to the signal.
Thank you very much.

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.