Time Delay Animation

I have character with a walking animation when the player moves the character forward. The problem is if the player jumps and moves forward the animation continues to loop mid jump. So I put in an if statement that says if the character is not grounded then stop the walking animation. Only problem is it will stop the walking animation mid animation. What I want is when the player hits jump, it will cycle through the last frames of the walk animation then stop. How can I put in a Time Delay so the animation will finish before the animation.Stop is called. I tried WaitForSeconds (1); but that didn’t seem to work, unless I’m using it wrong.Here’s a section of my code.

`function FixedUpdate() {
var inputX = Input.GetAxis(“Horizontal”);

if (Input.GetButton("Horizontal")){

if (!grounded){


I figured it out I just added a &&grounded to my if (Input.GetButton(“Horizontal”)){
} That way it will check to see if the character is grounded before playing the animation and won’t let it loop in mid air.