docs.unity.cn
    Show / Hide Table of Contents

    Interface IAsyncComponent

    Interface to implement by a component to be able to run a C# async task.

    Inherited Members
    IRunnableComponent.Tick(TimeSpan)
    Namespace: Unity.Reflect.ActorFramework
    Syntax
    public interface IAsyncComponent : IRunnableComponent

    Methods

    WaitAsync(CancellationToken)

    Method called by the actor system in loop. When the task completes, this method is immediately re-executed, and the component's Tick(TimeSpan) method is scheduled to be executed. If data is shared between the component and the actor, this is the responsibility of the user to implement a synchronization mechanism, as WaitAsync(CancellationToken) and Tick(TimeSpan) may be executed simultaneously.

    Declaration
    Task<WaitResult> WaitAsync(CancellationToken token)
    Parameters
    Type Name Description
    CancellationToken token

    A token to be able to cancel the task.

    Returns
    Type Description
    Task<WaitResult>

    A task with a result to be re-executed again or to stop, both possible results signal the scheduler to execute the Tick(TimeSpan) method.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on 03 February 2022
    Terms of use