stopping 1 animation and playing another
i wrote the following code for he player to transition between skiing to jumping animation when pressed space, and back to skiing from jumping when hes on the ground. however when i press space, the skiiping anim stops and the jumping never plays. please help me solve this if (Input.GetKeyDown(KeyCode.Space)) { if (this.animator.GetCurrentAnimatorStateInfo(0).IsName("skiing")) { animator.enabled = false; } animator.Play("jumping"); } if(grounded) { if (this.animator.GetCurrentAnimatorStateInfo(0).IsName("jumping")) { animator.enabled = false; } animator.Play("skiing"); }
Your answer
Follow this Question
Related Questions
Error CS0246: The type or namespace name 'ChallengeController' could not be found. 0 Answers
Player cannot double jump 1 Answer
How can I get a player to move in one direction and around it in the same time unity 2D 1 Answer
Pause scene when character hit object, then resume it from another scene 0 Answers
How to Make Game Object (Enemy) Move (Right to Left) in 2D Endless Runner Game? 0 Answers