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?

Thank you very much in advance!

Bit hairy ATM. Docs here. Sample here (can be installed from the package manager in Unity).

We’re working on a better solution.