Interface MonoSignal<T>

Represents a Unity-specific signal bound to either a C# event or a UnityEvent.

interface MonoSignal<T> {
    Connect(callback): MonoSignalConnection;
    ConnectWithPriority(priority, callback): MonoSignalConnection;
    DisconnectAll(): void;
    Once(callback): MonoSignalConnection;
    OnceWithPriority(priority, callback): MonoSignalConnection;
}

Type Parameters

  • T extends unknown[] | unknown

Methods

  • Connect a callback function to the signal. When the signal is fired, the callback will be invoked.

    To cancel propagation of the event to the next callbacks, the callback may return true to indicate a cancellation. Callbacks can only cancel the event if they have not yielded.

    Parameters

    • callback: MonoSignalCallback<T>

    Returns MonoSignalConnection

  • Connect a callback function to the signal with the given priority (highest priority goes first). When the signal is fired, the callback will be invoked.

    To cancel propagation of the event to the next callbacks, the callback may return true to indicate a cancellation. Callbacks can only cancel the event if they have not yielded.

    Parameters

    • priority: number
    • callback: MonoSignalCallback<T>

    Returns MonoSignalConnection

  • Disconnect all connections to this signal.

    Returns void

  • Connect a callback function to the signal. When the signal is fired, the callback will be invoked and the connection will be automatically disconnected.

    To cancel propagation of the event to the next callbacks, the callback may return true to indicate a cancellation. Callbacks can only cancel the event if they have not yielded.

    Parameters

    • callback: MonoSignalCallback<T>

    Returns MonoSignalConnection

  • Connect a callback function to the signal with the given priority (highest priority goes first). When the signal is fired, the callback will be invoked and the connection will be automatically disconnected.

    To cancel propagation of the event to the next callbacks, the callback may return true to indicate a cancellation. Callbacks can only cancel the event if they have not yielded.

    Parameters

    • priority: number
    • callback: MonoSignalCallback<T>

    Returns MonoSignalConnection