How to have character jump only once on Mobile
Hi, I am having some trouble figuring it out how i can have my character jump only when he is on the ground when pressing the UI.Button to jump. Currently, i can have it work well when on PC when I press a key. It is easy because everything is being checked in the Update function. But now with the fact that I have to use a separate function to be called for the button press, then it gives some issues to check if he is grounded. Anyone has a way of solving this?
Answer by RobWatling · Jan 08, 2016 at 10:43 AM
Make the button call a function that checks for your grounded bool, if he's grounded do the jump code otherwise don't.
You can move your code out of update into this method and then just call this method with the button and on update if you still need to.
Your answer
Follow this Question
Related Questions
how to jump my character to fixed distance 0 Answers
FPS Jump Help 0 Answers
how to jump in a 2D game 2 Answers
Spam jumping problem! 4 Answers