Signals and Events

Connecting signals to functions

To connect a signal to a function, use the connect method:

my_object.my_signal.connect(on_my_signal)

func on_my_signal():
    print("Signal received!")

Emitting signals

To emit a signal, you can use the emit_signal method:

emit_signal("my_signal")

However, it's better to ditch those strings, by simply calling emit method inside the signal directly:

my_signal.emit()

Defining signals

To define a signal, use the signal keyword followed by the signal name:

signal my_signal
Comments