reckfellENGINE

Signal

An owner/name signal pair with C# await support.

On this page
struct SignalReckfellSharpInherits ValueType

A C# struct storing an Owner object and a signal Name. Signal(owner, name) stores this pair; it does not declare a new signal on the object. Signal implements the await protocol through GetAwaiter(): waiting completes when the corresponding owner signal occurs.

For example, ProcessFrame belongs to EntityTree. Waiting requires a live owner and the exact EntityTree.SignalName.ProcessFrame name; default(Signal), with empty references, is not a ready-to-use awaitable.

Signal has no C# conversion to bool. An Owner alone does not establish signal existence or whether it has already been emitted. Use normal event subscriptions for handlers exposed as C# events.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

SignalConstructor
# Signal
C#
public Signal(ReckfellObject owner, StringName name);

Stores owner and the name wrapper. Does not declare a signal, subscribe or buffer past emissions. Waiting requires a live owner and an existing signal; check dynamic names with owner.HasSignal(name). Stores the same StringName wrapper: do not dispose it before using the Signal.

Parameters
NameTypeDefault
ownerReckfellObject—
nameStringName—
owner

Live object exposing the signal; Signal does not own its native lifetime.

name

Exact existing signal name, preferably a SignalName constant. This does not declare a new signal.

Properties2

NameProperty
# Name
C#
public StringName Name { get; }

Returns the stored signal-name wrapper. It neither verifies signal existence nor describes its latest emission. default(Signal) returns null. The name is borrowed; do not Dispose a shared SignalName constant or a wrapper still in use.

OwnerProperty
# Owner
C#
public ReckfellObject Owner { get; }

Returns the stored owner reference. The reference does not guarantee the native object still exists; check ReckfellObject.IsInstanceValid when needed. default(Signal) returns null. Reading neither subscribes nor transfers object ownership.

Methods1

GetAwaiterIAwaiter<Variant[]>
# GetAwaiter
C#
public IAwaiter<Variant[]> GetAwaiter();

Creates a new awaiter and immediately connects a one-shot handler for the next signal emission. C# calls this method for await signal. Another GetAwaiter creates an independent wait; past emissions are not replayed.

The result is an array of copied Variant arguments in signal declaration order. Dispose its elements after reading; a signal without arguments returns an empty array. WaitNextProcess in the example uses the built-in ProcessFrame and disposes the result.

C#
using System.Threading.Tasks;
using Reckfell;

public static class CallableSignalExamples
{
    public static int Twice(int value)
    {
        var callback = Callable.From<int, int>(static number => number * 2);
        using var argument = Variant.From(value);
        using var result = callback.Call(argument);
        return result.AsInt32();
    }

    public static void SetLabelLater(Label label, string text)
    {
        var callback = Callable.From<string>(value =>
        {
            if (ReckfellObject.IsInstanceValid(label)) label.Text = value;
        });
        using var argument = Variant.From(text);
        callback.CallDeferred(argument);
    }

    public static async Task WaitNextProcess(EntityTree tree)
    {
        Variant[] arguments = await new Signal(tree, EntityTree.SignalName.ProcessFrame);
        foreach (var argument in arguments) argument.Dispose();
    }
}

There is no CancellationToken parameter or automatic completion when owner is freed: the wait can remain incomplete. Do not place required resource cleanup only after this await. For a repeated handler with controlled unsubscription, use ordinary C# += and -= events; see C# signals.

Returns IAwaiter<Variant[]>

New awaiter for the next emission, returning Variant[]. It does not establish a successful connection for an invalid name or provide automatic cancellation.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.