EventSystems Unity OnPointerDown
using UnityEngine;
using UnityEngine.EventSystems;/*To use the OnPointerDown, you must inherit from the IPointerDownHandler
and declare the function as public*/
public class Test : MonoBehaviour, IPointerDownHandler
{
/*Called whenever a mouse click or touch screen tap is registered
on the UI object this script is attached to.*/
public void OnPointerDown(PointerEventData eventData)
{
switch (eventData.pointerId)
{
case -1:
Debug.Log("Left mouse click registered");
break;
case -2:
Debug.Log("Right mouse click registered");
break;
case -3:
Debug.Log("Center mouse click registered");
break;
case 0:
Debug.Log("Single tap registered");
break;
case 1:
Debug.Log("Double tap registered");
break;
case 2:
Debug.Log("Triple tap registered");
break;
}
}
}