Hello,
I’m making a mobile game. During the game, on the screen there are some UI buttons. If the player presses on a button, the button is pressed and an event occurs.
If the player presses on the screen, the player’s character jumps.
The problem is - when pressing a UI button, the character jumps as well - because screen touches must be taken as an input for this purpose.
How can I prevent the player’s character from jumping, if the touch screen press is made on a button, and not on any other part of the screen? I saw a function “.IsPressed” that the “Button” component inherits. However, this is a protected function for triggering an event…
I need some way to either block out part of the screen from causing the character to jump or some way of preventing the jump action from triggering when pressing on a UI button. But there doesn’t seem to be any way of getting the state of a button.
I’d be grateful for any help.
Thanks.