Animation problem - simple fix

ReviveEarly

New member
Joined
Apr 28, 2021
Messages
1
Programming Experience
1-3
Hello forum, hope you are all well. I have a little problem with my animation, which i'm certain is a simple fix.

Here is my code in the update function

C#:
if ((Input.GetKeyDown(KeyCode.Q)))
            {
                bool fire = Input.GetButtonDown("Q");
                animator.SetTrigger("walking");
                animator.SetFloat("walk", 5);
            }

animator is set in Start function, as well as float walk which also exists as an animation parameter.

My animator has 3 transitions, idle, walk and jump. Idle has two transitions to walk based on a float called walk that when greater than 0 the animation should run, and when less than the animation stops. I then have a transition from walk to jump that goes by whether the player is grounded or not, a boolean. Then two from jump back to idle based on ground being false.

Upon running the game, the walk animation runs without prompt and then shortly after goes straight to jump with no idle.

I have no idea how to solve this issue as I am a beginner and watching tutorials online. Please help!

Kind regards.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
2,994
Location
Chesapeake, VA
Programming Experience
10+
Is this Unity code? If so, someone should move this out of VS.NET general discussion.
 
Top Bottom