title: Coroutine completely freezes Unity 2020.3
body: <p>I'm making a first-person game and am having trouble animating my character. I have the right animations in place. I need to find a way to make the game detect when the player has just landed on the ground so that I can play the 'landing' animation. The problem is that the only way I've thought of thus far to do this is with a coroutine. But the coroutine, when initiated, completely freezes my whole application. I suspect it's because the act of being midair initiates the coroutine once per frame. Here's the script:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class PlayerAnimationHandler : MonoBehaviour
  {
  Animator animator;
  
  IEnumerator LandDetect()  
  {
      while (!playermove.isGrounded)
      {
          animator.SetBool(&quot;Midair&quot;, true);
      }
      animator.SetTrigger(&quot;Land&quot;);
      yield return null;
  }
  
  PlayerMove playermove;
  void Start()
  {
      // These are the two most important components for this 
      // script. I'll need PlayerMove for the mini-API
      // that I have in there and I'll need the animator
      // for obvious reasons.
      playermove = GetComponent&lt;PlayerMove&gt;();
  
      animator = GetComponent&lt;Animator&gt;();
  }
  
  // Update is called once per frame
  void Update()
  {
      JumpHandler();
  }
  
  void JumpHandler()
  {
      if (!playermove.isGrounded)
      {
          if (playermove.doubleJumpOccur)
          {
              animator.SetTrigger(&quot;DoubleJump&quot;);
              StartCoroutine(LandDetect());
          }
          else
          {
              animator.SetBool(&quot;Midair&quot;, true);
              StartCoroutine(LandDetect());
          }
      }
      else if (playermove.jumpOccur)
      {
          animator.SetTrigger(&quot;Jump&quot;);
          StartCoroutine(LandDetect());
      }
  }
  </code></pre>
  <p>}</p>