In make Unity3d mobile application. And I have a problem: How detect touch on UI or not?
I try this (but now work)
UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()
and this
private static List<RaycastResult> tempRaycastResults = new List<RaycastResult>();
public bool PointIsOverUI(float x, float y)
{
var eventDataCurrentPosition = new PointerEventData(EventSystem.current);
eventDataCurrentPosition.position = new Vector2(x, y);
tempRaycastResults.Clear();
EventSystem.current.RaycastAll(eventDataCurrentPosition, tempRaycastResults);
return tempRaycastResults.Count > 0;
}