logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct UnityProceduralContext

    Unity-specific procedural context passed to all layers and actions. Provides convenient access to state values via UnityStateKey references.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Serenity.ProceduralAnimator.Infrastructure.Settings
    Assembly: Serenity.UnityProceduralAnimator.Infrastructure.dll
    Syntax
    public readonly struct UnityProceduralContext

    Constructors

    UnityProceduralContext(IStateReader, float, float)

    Creates a new UnityProceduralContext. LayerTime defaults to time, so behavior is unchanged for every existing caller.

    Declaration
    public UnityProceduralContext(IStateReader stateReader, float time, float deltaTime)
    Parameters
    Type Name Description
    IStateReader stateReader
    float time
    float deltaTime

    UnityProceduralContext(IStateReader, float, float, float)

    Creates a new UnityProceduralContext with an explicit layer-local time.

    Declaration
    public UnityProceduralContext(IStateReader stateReader, float time, float deltaTime, float layerTime)
    Parameters
    Type Name Description
    IStateReader stateReader
    float time
    float deltaTime
    float layerTime

    Fields

    DeltaTime

    Delta time in seconds.

    Declaration
    public readonly float DeltaTime
    Field Value
    Type Description
    float

    LayerTime

    Seconds since the owning layer was last activated (see ProceduralAnimatorComponent.ActivateLayer). Equals Time for layers using LayerPhaseMode.ABSOLUTE (the default) — only LayerPhaseMode.ON_ACTIVATE layers read this instead of Time to drive their phase/step progression.

    Declaration
    public readonly float LayerTime
    Field Value
    Type Description
    float

    StateReader

    Reader for accessing state values from the state bus.

    Declaration
    public readonly IStateReader StateReader
    Field Value
    Type Description
    IStateReader

    Time

    Current time in seconds.

    Declaration
    public readonly float Time
    Field Value
    Type Description
    float

    Methods

    GetState(StateKeyId, float)

    Gets a state value by StateKeyId with optional default.

    Declaration
    public float GetState(StateKeyId key, float defaultValue = 0)
    Parameters
    Type Name Description
    StateKeyId key
    float defaultValue
    Returns
    Type Description
    float

    GetState(UnityStateKey, float)

    Gets a state value by UnityStateKey with optional default.

    Declaration
    public float GetState(UnityStateKey key, float defaultValue = 0)
    Parameters
    Type Name Description
    UnityStateKey key
    float defaultValue
    Returns
    Type Description
    float

    ToDomainContext()

    Converts to domain ProceduralContext.

    Declaration
    public ProceduralContext ToDomainContext()
    Returns
    Type Description
    ProceduralContext

    WithLayerTime(float)

    Returns a copy of this context with LayerTime replaced. Cheap and allocation-free — UnityProceduralContext is a struct.

    Declaration
    public UnityProceduralContext WithLayerTime(float layerTime)
    Parameters
    Type Name Description
    float layerTime
    Returns
    Type Description
    UnityProceduralContext
    In this article
    © 2026 Serenity. All Rights Reserved