Quick answer: SetLayerWeight is instant — there is no built-in lerp. Store target weight, lerp each frame with Mathf.MoveTowards, and pass the lerped value to SetLayerWeight. Also verify the layer has a valid avatar mask and blend mode.

Here is how to fix Unity Mecanim layer weight not blending. You have an upper body aim layer that should fade in when the player holds a weapon and fade out when holstered. You call animator.SetLayerWeight(1, 1f) when the weapon draws, expecting smooth blend-in. Instead the aim pose snaps on instantly. Or the layer never affects animation at all. Mecanim layers require multiple settings to cooperate.

The Symptom

Setting a layer weight via code produces unexpected behavior:

What Causes This

SetLayerWeight is instant. No interpolation. Calling SetLayerWeight(1, 1f) is equivalent to snapping weight from 0 to 1. If you want a blend, you have to drive the weight over multiple frames yourself.

No avatar mask. Without a mask, an Override layer at weight 1 overrides every bone — including lower body. An aim layer then freezes legs. Assign a mask with only upper-body bones enabled.

Blend mode wrong. Override layers replace. Additive layers add deltas. Using Override for subtle effects (like aim sway) snaps the whole upper body to the aim pose. Using Additive when you intended full replacement means the layer’s transforms are offsets, not absolutes.

IK Pass disabled. If your layer uses IK (animator IK hooks or Animation Rigging), each layer has an IK Pass checkbox in layer settings. Without it enabled, IK does not fire for that layer.

The Fix

Step 1: Drive layer weight smoothly.

using UnityEngine;

public class LayerBlender : MonoBehaviour
{
    [SerializeField] private Animator animator;
    [SerializeField] private int layerIndex = 1;
    [SerializeField] private float blendSpeed = 4f;

    private float targetWeight = 0f;
    private float currentWeight = 0f;

    public void SetActive(bool active)
    {
        targetWeight = active ? 1f : 0f;
    }

    void Update()
    {
        currentWeight = Mathf.MoveTowards(currentWeight,
            targetWeight, blendSpeed * Time.deltaTime);
        animator.SetLayerWeight(layerIndex, currentWeight);
    }
}

MoveTowards produces a linear blend at blendSpeed units per second. For a fade of 0.5 seconds, blendSpeed = 2.

Step 2: Create and assign an avatar mask. Project > Create > Avatar Mask. For humanoid rigs, toggle Body sections (Head, Left Arm, Right Arm, Body) as desired. For generic rigs, use the Transform tab and toggle specific bones.

Select the Animator Controller. Select the aim layer. Click the gear icon to expand Layer Settings. Assign the Mask field. Now the layer only influences masked bones.

Step 3: Pick the right blend mode. In layer settings:

For additive layers, the clip should be set up as additive in its import settings: Anim Type = Additive with a reference frame.

Step 4: Verify layer index. Layer 0 is the Base layer. Additional layers are 1, 2, 3, etc. Mistaking layer 0 for your aim layer — or vice versa — produces confusing “base layer weight 1 does nothing” or “aim layer does nothing because I set layer 0.”

Debug.Log($"Layer {layerIndex}: weight={animator.GetLayerWeight(layerIndex)}");

Log to verify what you think the index is.

Sync Layers

For two layers that should share a state machine (e.g. lower body and upper body both driven by “walk”), enable Sync on the second layer and set Source Layer. Now both layers transition together based on the source’s state. Avoid independent transitions causing sync drift.

“SetLayerWeight is a switch. For a dimmer, write the lerp yourself. Two lines of code buy smooth blending.”

Related Issues

For animator transition issues, see Mecanim Root Motion Sliding. For root motion, Animator Root Motion Not Applied.

Lerp the weight yourself. Assign a mask. Pick Override vs Additive intentionally.