Attention: Here be dragons
This is the
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
A built-in type representing a signal of an Object.
Signal is a built-in Variant type that represents a signal of an Object instance. Like all Variant types, it can be stored in variables and passed to functions. Signals allow all connected Callables (and by extension their respective objects) to listen and react to events, without directly referencing one another. This keeps the code flexible and easier to manage.
In GDScript, signals can be declared with the
signal keyword. In C#, you may use the
[Signal] attribute on a delegate.
signal attacked # Additional arguments may be declared. # These arguments must be passed when the signal is emitted. signal item_dropped(item_name, amount)
[Signal] delegate void AttackedEventHandler(); // Additional arguments may be declared. // These arguments must be passed when the signal is emitted. [Signal] delegate void ItemDroppedEventHandler(string itemName, int amount);
There are notable differences when using this API with C#. See API различия C# и GDScript for more information.
Signal ( )
emit ( ... ) vararg const
get_connections ( ) const
get_name ( ) const
get_object ( ) const
get_object_id ( ) const
is_null ( ) const
Signal Signal ( )
Constructs an empty Signal with no object nor signal name bound.
Constructs a Signal as a copy of the given Signal.
Creates a new Signal named
signal in the specified
Connects this signal to the specified
flags can be also added to configure the connection's behavior (see ConnectFlags constants). You can provide additional arguments to the connected
callable by using Callable.bind.
A signal can only be connected once to the same Callable. If the signal is already connected, returns