jumping animation not working when on walk animation

PS: just to clarify all states numbers are correct and in the code I’m just trying to make it work for the right arrow for right now.

when i just jump and not walk it works, when i press right arrow its going forward with the walk animation but when i"m trying to jump while moving its stays in walk animation.

here’s the some of the code code.

        if (Input.GetKey(KeyCode.RightArrow) && !Input.GetKeyDown(KeyCode.Space))



            {

                    anim.SetInteger("warriorStates", 1);
       
 

    
              

                    transform.rotation = Quaternion.Euler(0, 0, 0);



                    transform.Translate(characterController, 0, 0);




              



            }

if (Input.GetKey(KeyCode.RightArrow) && Input.GetKeyDown(KeyCode.Space) && makeJumpOnce == true)

{

StartCoroutine(“jumpOnlyOnceAndWaitToJumpAgain”);

}

Your post came up badly formatted, but GetKeyDown will be true for only 1 frame. Is it perhaps setting the animation back to walk after that 1 frame?

Couple of things about your post: If you can avoid giant holes of whitespace and keep all of the code inside the tags, it would be nicer. :slight_smile:

yes i think this is it, its going back to walk after the frame, I don’t know how i will make it jump with jump animation while moving. the problem is the GetKeyDown is only one frame like you said so it does not stay on the animation

It just occurred to me to refresh my memory and look at my own (semi complete) character.
I have a jump trigger setup which has “has exit time” with the animation. This will allow the animation to go through an entire cycle before allowing a transition.

You could try that & see if it looks okay for you.