- Home /
Not able to jump
I am new to Unity and was using a YouTube video to make a basic game. After that I got rid of the basic objects and put in a Santa as the "player" since Christmas is right around the corner. So I was able to get the left, right, up, and down movements to work but jumping just won't work. If you have an answer to this please reply thanks!
Answer by unity_ka6jgzfPPmtNCw · Nov 12, 2021 at 06:49 AM
The issue you're having is you're changing the velocity in the same update loop (not really, but it's causing your troubles). When you jump, you're changing the velocity based on your horizontal/vertical inputs and then changing the velocity again in the IsGrounded again... in itself, that's fine.
The issue is as soon as you take your finger off the jump, the horizontal/vertical inputs take over and the jump is no longer taking effect.
So maybe try:
if (IsGrounded() ) { if (Input.GetButtonDown("Jump") { Jump(); } else { // change horizontal/vertical velocity } }
and it'll work better.
Your answer
Follow this Question
Related Questions
Sphere can jump, but doesn't stop. 1 Answer
Increase jumpheight while holding down a key 3 Answers
Multiple jump C# Script. 2 Answers
Jumping in only the direction of the last key pressed 0 Answers
Hey Guys I have a problem with a single jump script. 1 Answer