Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Signal

A built-in type representing a signal of an Object.

Description

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)

Примечание

There are notable differences when using this API with C#. See API различия C# и GDScript for more information.

Tutorials

Constructors

Signal

Signal ( )

Signal

Signal ( Signal from )

Signal

Signal ( Object object, StringName signal )

Methods

int

connect ( Callable callable, int flags=0 )

void

disconnect