logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class ModelAnimatorTransitionCreator

    Adds and removes transitions on an already-created UnityEditor.Animations.AnimatorController, and sets a layer's default weight. Split out of ModelAnimatorCreator for the same size-guidance reason as ModelAnimatorParameterCreator — a transition is its own authoring surface (it can start from AnyState instead of a state, and needs its own exit-time default policy) rather than another state-shaped edit; the layer-weight setter rides along here since it shares this file's layer-index resolution and has no state/transition shape of its own to justify a fourth file.

    Inheritance
    object
    ModelAnimatorTransitionCreator
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Editor.AnimationHub.Authoring
    Assembly: Serenity.AnimationHub.Editor.dll
    Syntax
    public static class ModelAnimatorTransitionCreator

    Fields

    AnyStateSourceToken

    Source-state token for an AnyState transition. A null or empty sourceStatePath is also accepted as AnyState — the same "empty means AnyState" convention SourceStatePath already reports.

    Declaration
    public const string AnyStateSourceToken = "AnyState"
    Field Value
    Type Description
    string

    Methods

    AddTransition(string, int, string, string, TransitionCondition?)

    Adds a transition from sourceStatePath (or AnyStateSourceToken/empty for AnyState) to destinationStatePath, both resolved the same flattened-path way Serenity.Editor.AnimationHub.Authoring.ModelAnimatorCreator.RequireState(UnityEditor.Animations.AnimatorController,System.Int32,System.String,UnityEditor.Animations.AnimatorStateMachine@) resolves a state elsewhere in this window. Leaving condition null adds a plain exit-time transition instead — see Serenity.Editor.AnimationHub.Authoring.ModelAnimatorTransitionCreator.ApplyExitTimeDefault(UnityEditor.Animations.AnimatorStateTransition,System.Boolean) for which one it defaults to and why.

    Declaration
    public static ModelAnimatorCreator.StateOperationResult AddTransition(string controllerAssetPath, int layerIndex, string sourceStatePath, string destinationStatePath, ModelAnimatorTransitionCreator.TransitionCondition? condition = null)
    Parameters
    Type Name Description
    string controllerAssetPath
    int layerIndex
    string sourceStatePath
    string destinationStatePath
    ModelAnimatorTransitionCreator.TransitionCondition? condition
    Returns
    Type Description
    ModelAnimatorCreator.StateOperationResult

    DeleteTransition(string, int, string, string, int)

    Removes one transition between sourceStatePath (or AnyState) and destinationStatePath, as a sub-asset of the controller. When more than one transition targets the same destination, matchIndex (0 = first encountered) picks which.

    Declaration
    public static ModelAnimatorCreator.StateOperationResult DeleteTransition(string controllerAssetPath, int layerIndex, string sourceStatePath, string destinationStatePath, int matchIndex = 0)
    Parameters
    Type Name Description
    string controllerAssetPath
    int layerIndex
    string sourceStatePath
    string destinationStatePath
    int matchIndex
    Returns
    Type Description
    ModelAnimatorCreator.StateOperationResult

    SetLayerDefaultWeight(string, int, float)

    Sets a layer's default weight. THE layers-copy trap: UnityEditor.Animations.AnimatorController.layers returns a fresh array copy on every read (the same gotcha Serenity.Editor.AnimationHub.Authoring.ModelAnimatorCreator.RequireLayerStateMachine(UnityEditor.Animations.AnimatorController,System.Int32) documents for the state machine's own layer lookup) — writing layers[layerIndex].defaultWeight alone silently no-ops without the explicit controller.layers = layers writeback below.

    Declaration
    public static ModelAnimatorCreator.StateOperationResult SetLayerDefaultWeight(string controllerAssetPath, int layerIndex, float weight)
    Parameters
    Type Name Description
    string controllerAssetPath
    int layerIndex
    float weight
    Returns
    Type Description
    ModelAnimatorCreator.StateOperationResult
    In this article
    © 2026 Serenity. All Rights Reserved