title: Unity: 2D animator only playing first frame of animation
body: <p>I'm having a problem getting a death animation to play in full.</p>
  
  <p>I have the animation set up correctly in the Unity animator with a bool isDead as a condition to change state from 'Any State' to 'Vampire Death'.</p>
  
  <p><a href="https://i.stack.imgur.com/94o23.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/94o23.jpg" alt="Animator image"></a></p>
  
  <p>The player character already has an attached Animator (and indeed plays the default flying animation just fine).</p>
  
  <p><a href="https://i.stack.imgur.com/iSR53.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iSR53.jpg" alt="Animator component attached"></a></p>
  
  <p>I need to ensure the death animation plays in full before the rest of the logic within</p>
  
  <pre><code>//Game over on collision with obstacles
  private void OnCollisionEnter2D(Collision2D collision)
  {
  ...
  }
  </code></pre>
  
  <p>is called.</p>
  
  <p>Here's my player controller script...</p>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using UnityEngine.UI;
  using UnityEngine.SceneManagement;
  
  public class VampireBatController : MonoBehaviour {
  
      //Declarations
      Rigidbody2D bat;
      public static int score;
      public static int finalScore;
      public static int highScore;
      public Text scoreText;
      public AudioClip flapSound;
      public AudioClip crashSound;
      public int batColliderIndex = 0;
  
      public Animator myAnimator;
  
      [SerializeField] private PolygonCollider2D[] colliders;
  
  
  
      // Use this for initialization
      void Start () {
          score = 0;
  
          bat = GetComponent&lt;Rigidbody2D&gt;();
  
          myAnimator = gameObject.GetComponent&lt;Animator&gt;();
  
          scoreText.text = score.ToString();
      }
  
      // Update is called once per frame
      void Update()
      {
          //Update score display
          scoreText.text = score.ToString();
          Debug.Log("SCORE: " + score);
  
          //Player input
          if (Input.GetMouseButtonDown(0))
          {
              bat.velocity = new Vector2(0, 4);
              SoundManager.instance.PlaySingle(flapSound);
          }
      }
  
      //Point increment function
      private void OnTriggerEnter2D(Collider2D collision)
      {
          if (collision.gameObject.tag == "Point" &amp;&amp; batColliderIndex == 9)
          {
              score++;
              return;
          }
      }
  
      //Game over on collision with obstacles
      private void OnCollisionEnter2D(Collision2D collision)
      {
          if (collision.gameObject.tag=="Skyscraper" || collision.gameObject.tag=="GroundCollider")
          {
              //Impact sound plays
              SoundManager.instance.PlaySingle(crashSound);
  
              //vampire_death animation plays
              //I wonder why only the first frame of the animation plays?
              myAnimator.SetBool("isDead", true);
  
              finalScore = score;
              Debug.Log("Game Over State Final Score: " + finalScore);
  
              if (score &gt;= highScore)
              {
                  highScore = score;
              }
  
              //Send highScore to PlayerPrefs
              PlayerPrefs.SetInt("savedHighScore", highScore);
              Debug.Log("Game Over State HIGH SCORE: " + highScore);
  
              //Load game over screen
              SceneManager.LoadScene(2);
              Debug.Log("Loading game over scene");
          }
      }
  
      //Sprite collider selector by animation frame
      public void SetColliderForSprite(int spriteNum)
      {
          colliders[batColliderIndex].enabled = false;
          batColliderIndex = spriteNum;
          colliders[batColliderIndex].enabled = true;
      }
  
  }
  </code></pre>
  
  <p>Any suggestions as to where I'm going wrong or what I can do to ensure the animation plays fully before moving on to the rest of the game over state?</p>