title: Playing a random animation after some time without input
body: <p>So here's what I'd like to do: The player is idling on the ground, not moving at all. And after some time a random idle animation should be played. How do I detect that the player hasn't been moving for a certain amount of time?</p>
  
  <pre><code>IEnumerator Idle()
  {
      // check if player is idling on the ground
      if (grounded &amp;&amp; (_controller.velocity.x == 0))
      {
          // Now what?
          //...
      }
      idleIndex = IdleRandom();
      _animator.SetInteger("IdleIndex", idleIndex);
      _animator.SetTrigger("Idle");
  }
  
  int IdleRandom()
  {
      // choose random index of idle animations
      int i = Random.Range(0, numberOfIdleAnims);
  
      // if it's the same as the previous one...
      if (i == idleIndex) {
          // try another one
          return IdleRandom ();
      }
      else
          return i;
  }
  </code></pre>
  
  <p>I've already set up my animator controller so that it would play one of the idle animations (chosen by the idleIndex) if the idle-Trigger is pushed. The only thing I cannot figure out is the not-moving-in-certain-time thing!</p>