检测鼠标是否在某个UI的RectTransform上:
RectTransform myRect = GetComponent<RectTransform>();
bool isContain = RectTransformUtility.RectangleContainsScreenPoint(myRect ,
Input.mousePosition);
检测是否点击的是UI:
EventSystem.current.IsPointerOverGameObject();
检测鼠标是否在某个UI的RectTransform上:
RectTransform myRect = GetComponent<RectTransform>();
bool isContain = RectTransformUtility.RectangleContainsScreenPoint(myRect ,
Input.mousePosition);
检测是否点击的是UI:
EventSystem.current.IsPointerOverGameObject();