SignalSwap — shared connect/disconnect idiom for exported signal sources. Several initializers reimplement the "disconnect old -> assign -> connect new" setter pattern by hand (MoveOnSpawn 2D/3D, PickupAnimationPlayer). Centralizing it here keeps the three copies in lockstep and adds the freed-instance guard the original copies lacked (M10 from the audit): if the old source was freed between setter calls, disconnecting it would error, so we skip the disconnect when it is no longer a valid instance. Usage in an exported setter: @export var spawner: SceneSpawner2D: set(value): SignalSwap.reassign(spawner, value, "spawned", _on_spawned) spawner = value
Source: addons/item_vault/scene_spawner/signal_swap.gd
Syntax
class SignalSwap extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
reassign | Method |