Here's how you do it in Unity today:
Naturally, you have an EventSystem in the hierarchy (you get one of them automatically when you add a Canvas; inevitably, each scene already has one)
Add a physical Raycaster to the camera (it takes one click)
Do this:
,
using UnityEngine.EventSystems; public class Gameplay:MonoBehaviour, IPointerDownHandler { public void OnPointerDown(PointerEventData eventData) { Bingo(); } }
Basically , again, basically , that's all there is to it.
It's simple: this is how you deal with touches in Unity. That is all that needs to be done.
Add raycaster and get this code.
It looks easy and simple. However, it can be difficult to do well.
(Footnote: some drags from Unity: the horrors of OnPointerDown and OnBeginDrag in Unity3D )
Sensity's Unity journey was exciting:
"Early unity" ... was extremely easy. It is completely useless. Didn't work at all.
The "current" new "Unity" ... Works great. Very simple but difficult to use in an expert way.
"Coming Unity" ... Around 2025, they will make BOTH actually work and be easy to use. Do not hold your breath.
(The situation is no different from the Unity UI system. At first, the UI system was ridiculous. Now it is great, but somewhat difficult to use in an expert way. Since 2019, they are going to completely change it again.)
(The network is the same. At first it was complete garbage. The βnewβ network was / was pretty good, but it had a very poor choice. More recently, in 2019, the network changed again.)
Helpful advice!
Remember! When you have a full-screen invisible panel that contains several buttons. On the most full-screen invisible panel, you must turn off the broadcast! This is easy to forget:

Historical question: here is a rough and quick fix for "ignoring the user interface" that you could use in Unity many years ago ...
if (Input.GetMouseButtonDown(0)) {
You cannot do this anymore for several years.