IEnumerator MonitorAnimation(SpriteAnimator anim, bool repeat) { // Play Animation anim.repeat = repeat; anim.Play(); if (!anim.repeat) { yield return(new WaitForSeconds(anim.GetTime())); // Reset to default animation SetAnimation(m_defaultAnim); } }