I want a not manual way to connect several nodes to the same signal

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SubBut

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?

:bust_in_silhouette: Reply From: Inces

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 ?

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?

SubBut | 2022-03-21 12:28

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

Inces | 2022-03-21 15:40

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.

SubBut | 2022-03-21 22:29