logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AnimatorControllerClipRewirer

    Repoints every reference to one UnityEngine.Motion inside an UnityEditor.Animations.AnimatorController to another — the controller-side half of "Make Editable Copy" (see AnimationClipCopyEngine, which creates the standalone copy and calls into this type before committing). Walks every layer's state machine at arbitrary nesting depth, and every blend tree at arbitrary nesting depth, the same recursive shapes ModelAnimationScanner.CollectStatesAndTransitions and ModelAnimationScanner.CollectBlendTreeClips already use to read this exact structure. FindStatesUsing(AnimatorController, Motion) is the read-only counterpart for a "3 states use this clip" banner before a caller commits to a rewire.

    Inheritance
    object
    AnimatorControllerClipRewirer
    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.Engine
    Assembly: Serenity.AnimationHub.Editor.dll
    Syntax
    public static class AnimatorControllerClipRewirer

    Methods

    FindStatesUsing(AnimatorController, Motion)

    Every state name (across every layer, including nested sub-state-machines) whose motion is motion directly, or a UnityEditor.Animations.BlendTree that contains it among its children (including nested blend trees). Read-only — mutates nothing.

    Declaration
    public static IReadOnlyList<string> FindStatesUsing(AnimatorController controller, Motion motion)
    Parameters
    Type Name Description
    AnimatorController controller
    Motion motion
    Returns
    Type Description
    IReadOnlyList<string>

    ReplaceMotion(AnimatorController, Motion, Motion)

    Walks every layer of controller (recursing into every nested sub-state-machine) and repoints any state whose motion is from to to via UnityEditor.Animations.AnimatorState.motion's setter — not a raw field assignment, so synced-layer state pairs stay correctly linked. Any state whose motion is a UnityEditor.Animations.BlendTree is walked too (recursing into nested blend trees), repointing every matching child. The whole walk is wrapped in one UnityEditor.Undo.RegisterCompleteObjectUndo(UnityEngine.Object,System.String) entry so a single Ctrl+Z reverts every state and blend tree this call touched, then persisted with UnityEditor.EditorUtility.SetDirty(UnityEngine.Object) and UnityEditor.AssetDatabase.SaveAssets.

    Declaration
    public static RewireResult ReplaceMotion(AnimatorController controller, Motion from, Motion to)
    Parameters
    Type Name Description
    AnimatorController controller
    Motion from
    Motion to
    Returns
    Type Description
    RewireResult
    In this article
    © 2026 Serenity. All Rights Reserved