UI Jump Button - I want to click on the button to jump but instead I jump when I click anywhere on the screen.
Hello, I'm very new to this and am trying to make a simple endless runner (or jumper) mobile game. I have coded my player to jump when I hit space or click the screen but I would like to make it so the player jumps only one time when I click specifically on the button. I've used multiple scripts before that I've attached to the button but I was unable to control how many times the player jumped before hitting the ground. I know can control that but can't seem to attach to the button specifically.
I think I understand that my code says to access both the spacebar and the mouse click but I this is the only script I've had success with controlling the amount of jumps.
Any help would be greatly appreciated. alt text
Your answer
![](https://koobas.hobune.stream/wayback/20220612233528im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to write a script for an existing button 1 Answer
Slide-Out Panel Animates on Button - How to Animate on Swipe Motion on Mobile? 1 Answer
Delayed jump on android 1 Answer
I need help making a UI button that when pressed shoots a projectile. 0 Answers
Porting to mobile how to assign input manager axes to GUIButtons. 0 Answers