if (Input.GetMouseButtonDown(0) || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began))
{
#if UNITY_ANDROID || UNITY_IPHONE
if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
#else
if (EventSystem.current.IsPointerOverGameObject())
#endif
Debug.Log("触摸");
else
Debug.Log("非触摸");
}
判断是否存在UI被触摸
最新推荐文章于 2022-04-25 22:49:41 发布