ANIMATION • MECANIM

Unity Animator Animation Not Playing or Stuck on First Frame

Fix animations failing to transition, getting locked in T-pose, or freezing after firing a single trigger.

The 3 Common Culprits

  1. Has Exit Time is Checked: If Has Exit Time is enabled on the transition from Idle, the Animator will wait for the entire Idle loop to finish before playing your action. Uncheck 'Has Exit Time' for instant responsive attacks or jumps.
  2. String Name Typo in C#: Typing animator.SetTrigger("shoot") when the parameter is named "Shoot" will fail silently. Use Animator.StringToHash for compile-time safety.
  3. Apply Root Motion: If enabled on a stationary animation, it can lock transform coordinates.
1

Type-Safe Hash Trigger Execution

SafeAnimationTrigger.cs (C#)
using UnityEngine;

[RequireComponent(typeof(Animator))]
public class SafeAnimationTrigger : MonoBehaviour
{
    private Animator anim;
    
    // Cache parameter hashes to eliminate string typos & GC allocations
    private static readonly int SpeedHash = Animator.StringToHash("Speed");
    private static readonly int FireHash = Animator.StringToHash("Fire");

    private void Awake()
    {
        anim = GetComponent<Animator>();
    }

    public void TriggerWeaponFire()
    {
        anim.SetTrigger(FireHash);
    }

    public void UpdateLocomotion(float speed)
    {
        anim.SetFloat(SpeedHash, speed);
    }
}

Troubleshooting Frozen or Unresponsive Animations in Unity Mecanim

Mecanim is Unity's state-machine animation system. When character models stand in a frozen T-pose or ignore animation transition parameters (like animator.SetBool("isFlying", true)), inspect these primary failure points:

  • Missing Controller Asset: Ensure the Controller slot on the Animator component references an active AnimatorController asset. If set to None, no states will ever play.
  • Has Exit Time Traps: In the Animator window, click the transition arrow between states. If Has Exit Time is checked, the transition will NOT occur immediately upon parameter change; it will wait until the current clip reaches its specified exit percentage (e.g. 75% or 95%). For responsive controls, uncheck Has Exit Time and set Transition Duration to 0.1s.
  • Parameter Name Typos: Parameter lookups like animator.SetFloat("speed", 5f) are case-sensitive. Calling "speed" when the parameter is named "Speed" will fail silently. Use Animator.StringToHash("Speed") for safe, optimized caching.
SafeAnimationController.cs (Hashed Parameters)
using UnityEngine;

[RequireComponent(typeof(Animator))]
public class SafeAnimationController : MonoBehaviour
{
    private Animator anim;
    // Cache integer parameter hashes to avoid string allocations and eliminate typos
    private static readonly int SpeedHash = Animator.StringToHash("Speed");
    private static readonly int AttackTriggerHash = Animator.StringToHash("Attack");

    private void Awake()
    {
        anim = GetComponent<Animator>();
    }

    public void UpdateSpeed(float currentSpeed)
    {
        anim.SetFloat(SpeedHash, currentSpeed);
    }

    public void TriggerAttack()
    {
        anim.SetTrigger(AttackTriggerHash);
    }
}