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);
    }
}