0

In a tablet game, in an New Input system Action map, I placed an aiming command conveyed by PrimaryTouch[touchscreen], next to other commands conveyed by gamepads, and buttons on the screen. The idea is to allow the player to aim by touching on the points of the screen not occupied by the buttons and the gamepad, Regardless of whether you are pressing the gamepad. My problem arises, however, when I press a button, or the gamepad, and the command to aim ALSO starts. In other words, the command to aim is read first, and therefore overlaps in an unintended way with the actions conveyed by the elements of the GUI.

I tried to put an if(!EventSystem.IsPointerOverGameObject()), but, since as I said, the aim command is read before the others.

So how can I avoid this overlap?

2
  • I soved it by adding a trasparent button on the backgroud, in the hierarchy before the other buttons, and by using it to regiter the input event. Commented Jul 8 at 17:09
  • 1
    Don't put [SOLVED] in the title. Post an answer below, and accept the best answer, that's how we indicate that the question is solved.
    – Barmar
    Commented Jul 8 at 17:14

0

Browse other questions tagged or ask your own question.