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
ModelAnimatorTransitionCreator
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
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
Returns
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
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