# How to stop an animation from looping

I want to make Unity play a squish animation when the player hits the ground, but only once, until the player jumps and hits the ground again, although Unity its constantly detecting that the player is on the ground and keeps playing the squish animation over and over again, only jumping stops it cause the condition to play the animation is if the player is on the ground. (loop already disabled) How I can possibly solve this?

 if (isGrounded == true)
anim.SetTrigger("EnterGround");

• btw, you can omit == true and the behavior won't change – trollingchar Jul 23 at 13:51

You need to store previous value of isGrounded. Change your code to this:
if (isGrounded && !wasGrounded) OnLanding ();

where wasGrounded is a boolean field and OnLanding is a method where you for example trigger animation.