logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class ProceduralLayerSO

    Base ScriptableObject for continuous procedural animation layers. Layers are evaluated every frame and contribute weighted offsets to the final pose and/or material properties. Examples: breathing, sway, tremor, arm hang, head twitch, color pulsing.

    Inheritance
    object
    ProceduralLayerSO
    ActivationSequenceLayerSO
    AimDirectionLayerSO
    DirectionalLeanLayerSO
    GaitCycleLayerSO
    GraphicColorSequenceLayerSO
    HighFrequencyNoiseLayerSO
    MaterialColorSequenceLayerSO
    PeriodicOscillationLayerSO
    PerlinDriftLayerSO
    RandomImpulseLayerSO
    StateModulatedOffsetLayerSO
    TransformPositionSequenceLayerSO
    TransformRotationSequenceLayerSO
    TransformScaleSequenceLayerSO
    Implements
    IProceduralLayer<UnityProceduralContext>
    IFoundationSettings
    Namespace: Serenity.ProceduralAnimator.Infrastructure.ProceduralLayers
    Assembly: Serenity.UnityProceduralAnimator.Infrastructure.dll
    Syntax
    public abstract class ProceduralLayerSO : ScriptableObject, IProceduralLayer<UnityProceduralContext>, IFoundationSettings

    Constructors

    ProceduralLayerSO()

    Declaration
    protected ProceduralLayerSO()

    Fields

    Guid

    Declaration
    public string Guid
    Field Value
    Type Description
    string

    GUID for this layer asset.

    Id

    Declaration
    public string Id
    Field Value
    Type Description
    string

    Unique identifier for this layer asset.

    displayName

    Declaration
    protected string displayName
    Field Value
    Type Description
    string

    phaseMode

    Declaration
    protected LayerPhaseMode phaseMode
    Field Value
    Type Description
    LayerPhaseMode

    repeatCount

    Declaration
    protected int repeatCount
    Field Value
    Type Description
    int

    Properties

    DisplayName

    Gets the display name for this layer.

    Declaration
    public string DisplayName { get; }
    Property Value
    Type Description
    string

    DrivenChannels

    The procedural evaluation channels this layer writes to. Every concrete layer MUST declare every channel its own Evaluate override(s) actually write — nothing more, nothing less. Consumers that only apply some channels (e.g. the HUD builder only applies Transform and Activation to a HUD element) gate applicability by intersecting this against the channels they apply, instead of switching on this layer's concrete type. Declaring a channel this layer never writes, or omitting one it does, silently breaks that gating for every consumer that relies on it.

    Declaration
    public abstract ProceduralChannels DrivenChannels { get; }
    Property Value
    Type Description
    ProceduralChannels

    PhaseMode

    Gets the phase mode governing how this layer's clock is derived. See LayerPhaseMode.

    Declaration
    public LayerPhaseMode PhaseMode { get; }
    Property Value
    Type Description
    LayerPhaseMode

    RepeatCount

    Gets the repeat count used in ON_ACTIVATE mode (0 = loop forever).

    Declaration
    public int RepeatCount { get; }
    Property Value
    Type Description
    int

    SequenceDurationSeconds

    The total duration in seconds of one full pass through this layer's sequence, or 0 if this layer has no natural end (e.g. a continuous oscillation — the default for every layer that doesn't override this). Used together with RepeatCount in ON_ACTIVATE mode so ProceduralAnimatorComponent knows when to auto-deactivate the layer. Override in sequence-based layers (e.g. TransformScaleSequenceLayerSO) to return the sum of all step durations.

    Declaration
    public virtual float SequenceDurationSeconds { get; }
    Property Value
    Type Description
    float

    Methods

    Evaluate(in UnityProceduralContext, float, ref PoseDelta)

    Evaluates this layer and adds its contribution to the pose delta. Called every frame for all active layers.

    Declaration
    public abstract void Evaluate(in UnityProceduralContext ctx, float weight, ref PoseDelta pose)
    Parameters
    Type Name Description
    UnityProceduralContext ctx

    The procedural context containing state and time information.

    float weight

    The weight of this layer (0-1). Used for blending.

    PoseDelta pose

    The pose delta to add contributions to.

    Evaluate(in UnityProceduralContext, float, ref PoseDelta, ref MaterialDelta)

    Evaluates this layer and adds its contribution to both pose and material deltas. Called every frame for all active layers. Override this method for layers that need to affect material properties. Default implementation calls the pose-only Evaluate method for backward compatibility.

    Declaration
    public virtual void Evaluate(in UnityProceduralContext ctx, float weight, ref PoseDelta pose, ref MaterialDelta material)
    Parameters
    Type Name Description
    UnityProceduralContext ctx

    The procedural context containing state and time information.

    float weight

    The weight of this layer (0-1). Used for blending.

    PoseDelta pose

    The pose delta to add contributions to.

    MaterialDelta material

    The material delta to add contributions to.

    Evaluate(in UnityProceduralContext, float, ref PoseDelta, ref MaterialDelta, ref TransformDelta)

    Evaluates this layer and adds its contribution to pose, material, and transform deltas. Called every frame for all active layers. Override this method for layers that need to affect transform properties (scale). Default implementation calls the pose+material Evaluate method for backward compatibility.

    Declaration
    public virtual void Evaluate(in UnityProceduralContext ctx, float weight, ref PoseDelta pose, ref MaterialDelta material, ref TransformDelta transform)
    Parameters
    Type Name Description
    UnityProceduralContext ctx

    The procedural context containing state and time information.

    float weight

    The weight of this layer (0-1). Used for blending.

    PoseDelta pose

    The pose delta to add contributions to.

    MaterialDelta material

    The material delta to add contributions to.

    TransformDelta transform

    The transform delta to add contributions to.

    Evaluate(in UnityProceduralContext, float, ref PoseDelta, ref MaterialDelta, ref TransformDelta, ref ActivationDelta)

    Evaluates this layer and adds its contribution to pose, material, transform, and activation deltas. Called every frame for all active layers. Override this method for layers that need to affect GameObject activation (see ActivationSequenceLayerSO). Default implementation calls the pose+material+transform Evaluate method for backward compatibility.

    Declaration
    public virtual void Evaluate(in UnityProceduralContext ctx, float weight, ref PoseDelta pose, ref MaterialDelta material, ref TransformDelta transform, ref ActivationDelta activation)
    Parameters
    Type Name Description
    UnityProceduralContext ctx

    The procedural context containing state and time information.

    float weight

    The weight of this layer (0-1). Used for blending.

    PoseDelta pose

    The pose delta to add contributions to.

    MaterialDelta material

    The material delta to add contributions to.

    TransformDelta transform

    The transform delta to add contributions to.

    ActivationDelta activation

    The activation delta to add contributions to.

    Evaluate(in UnityProceduralContext, float, ref PoseDelta, ref MaterialDelta, ref TransformDelta, ref ActivationDelta, ref UiColorDelta)

    Evaluates this layer and adds its contribution to pose, material, transform, activation, and UGUI Graphic-color deltas. Called every frame for all active layers. Override this method for layers that need to tint/fade a UGUI Graphic (see GraphicColorSequenceLayerSO). Default implementation calls the pose+material+transform+activation Evaluate method for backward compatibility.

    Declaration
    public virtual void Evaluate(in UnityProceduralContext ctx, float weight, ref PoseDelta pose, ref MaterialDelta material, ref TransformDelta transform, ref ActivationDelta activation, ref UiColorDelta uiColor)
    Parameters
    Type Name Description
    UnityProceduralContext ctx

    The procedural context containing state and time information.

    float weight

    The weight of this layer (0-1). Used for blending.

    PoseDelta pose

    The pose delta to add contributions to.

    MaterialDelta material

    The material delta to add contributions to.

    TransformDelta transform

    The transform delta to add contributions to.

    ActivationDelta activation

    The activation delta to add contributions to.

    UiColorDelta uiColor

    The UGUI Graphic-color delta to add contributions to.

    Remarks

    This is the newest, highest-arity overload — five delta channels is the ceiling for this stacked-overload shape. A sixth channel must NOT add a sixth overload: thread a sixth ref parameter through six overloads (and every call site — ProceduralAnimatorComponent.EvaluateLayers chief among them) the moment a seventh becomes necessary would make an already wide method signature unreadable. Instead, refactor to a single ProceduralDeltaSet struct bundling every delta and a single Evaluate(in ctx, weight, ref ProceduralDeltaSet deltas) method, with each layer writing only the facets it declares in DrivenChannels.

    OnLayerActivated()

    Optional initialization called when the layer becomes active. Override to set up any required runtime state.

    Declaration
    public virtual void OnLayerActivated()

    OnLayerDeactivated()

    Optional cleanup called when the layer becomes inactive. Override to clean up any runtime state.

    Declaration
    public virtual void OnLayerDeactivated()

    Implements

    IProceduralLayer<TContext>
    IFoundationSettings
    In this article
    © 2026 Serenity. All Rights Reserved