- Home /
New Input System: How to give precedence to UI buttons over in-game interactions?
Hello everyone!
Question summary: How to configure the input actions asset of my 2D game to give precedence to UI buttons over in-game interactions, like tapping anywhere (else) on the screen to jump?
I am currently developing a 2D infinite falling mobile game where I want the player to:
1. Move left and right using 2 UI buttons (TMPro), and 2. Jump whenever a tap occurs anywhere on the screen EXCEPT if the tap happens on the previously mentioned buttons (this will eventually include other buttons as well, like a pause menu button for example).
What happens right now is that if I tap on the left/right button to move the player just a little, they also jump, and I would like to avoid that.
How can I achieve the above using Unity's new input system? Can this configuration be achieved by tweaking the input actions assets only? What's more, I would like to be able to move the player and tap anywhere to jump at the same time (i.e., with 2 fingers). Is this possible through the input actions asset?
Thank you very much in advance!