Tween completed signal - does it affect just a single instance?

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

I have a “balloon” Area2D node/scene, with a separate TweenExpand and TweenContract node as children under Area2D. At runtime, I am instancing a random number of balloons, and randomising the tween of the scale on the “_ready” function.

I have connected the “on_completed” signals of the tweens back to the main parent Area2D script of the balloon scene…my question is, is the “on_completed” signal just being sent to the individual balloon instance, or is it impacting all balloon instances? I really just want the signal to be instance specific, which I would imagine it is? i.e. each balloon instance receives a signal from its own child tween instances when they complete, not generally broadcast to all balloon instances.

:bust_in_silhouette: Reply From: RedBlueCarrots

Instances of a node are completely separate entities, so yes, the signal will just affect the node (or instance in your case) that sent it.

If I have 50 balloons each with a tween in it. And the tween sends a signal when it completes to its parent balloon…,don’t all balloon instances receive the signal as soon as one tween completes?? That’s how it is wired (or one interpretation of it). My concern is I am wiring up a tween to effectively emit to its own parent node.

indy2005 | 2020-09-16 16:53

I’m pretty sure that an instance acts as an individual node, and so individually need to set up the signals. It’s possible that they al have connected to the same function, and so that could be an issue if you don’t reference the node that sent the signal within the function

RedBlueCarrots | 2020-09-17 03:28

I am setting up the signal connection in the inspector, and am instance going the nodes.

indy2005 | 2020-09-17 08:09