Animation

AnimatorControllerLayer

AnimatorControllerLayer (API) is used to organize and manage AnimatorStateMachine (see details) in an Animation Controller (detailed introduction). Each AnimatorControllerLayer has its own AnimatorStateMachine. When the Animator Component runs, all AnimatorControllerLayer run simultaneously, controlling the overall animation effect through blendingWeight and blendingMode.

PropertyDescription
NameThe name of the layer.
WeightThe blending weight of the layer, the default value is 1.0.
BlendingThe blending mode of the layer, Additive is additive mode, Override is override mode, the default value is Override.
StateMachineThe animation state machine of the layer, detailed introduction

Additive Mode

In additive mode, the higher layer's animation will be added on top of the lower layer's animation. This mode calculates the differences in animation keyframes and applies these differences to the lower layer's animation, achieving an additive effect (increasing the weight will not reduce the influence of the lower layer). It is often used to add details or adjustments to basic actions. For example, a breathing animation can be added on top of a walking animation using the Additive mode, or a facial expression change can be added during an attack.

Usage Example

We add an AnimatorControllerLayer in the editor and set Blending to Additive.

Override Mode

In override mode, the higher layer's animation will completely override the lower layer's animation. This means that in the final animation output, the higher layer's animation will take precedence and replace the lower layer's animation effect (increasing the weight will reduce the influence of the lower layer). It is often used for layered control of animations. For example, you may need to control different body parts' actions separately. The Override mode can control each part independently, such as adjusting the upper body's posture or actions while running.

The blending mode of the first layer is always override mode.

Usage Example

Set Blending to Override.

You can see that the character's animation completely replaces the animation of the first layer.

Blending Weight

It is used to control the influence of a specific AnimatorControllerLayer on the final animation result. It is a floating-point value between 0 and 1, determining the blending ratio of the layer's animation in the final animation. For example, an additive layer will rotate the character's head by 90 degrees. If the layer's blending weight is 0.5, the character will only rotate 45 degrees.

The weight of the first layer is always 1.0.

Usage Example

You can see that the higher the weight of the AnimatorControllerLayer, the greater its influence on the animation effect.

Script Usage

const layers = animator.animatorController.layers;
const baseLayer = layers[0];
const additiveLayer = layers[1];
// Additive mode
additiveLayer.blendingMode = AnimatorLayerBlendingMode.Additive;
// Override mode
additiveLayer.blendingMode = AnimatorLayerBlendingMode.Override;
additiveLayer.weight = 0.5;

Was this page helpful?