if (Input.GetMouseButtonDown (0) || (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Began)) {
#if UNITY_IPHONE || UNITY_IOS
if (EventSystem.current.IsPointerOverGameObject (Input.GetTouch (0).fingerId)) {
Debug.Log ("IPHONEuiover");
GameObject selectGo = EventSystem.current.currentSelectedGameObject;
if (selectGo != null) {
}
return;
}
#else
if (EventSystem.current.IsPointerOverGameObject ())
{
GameObject selectGo = EventSystem.current.currentSelectedGameObject;
if(selectGo!=null)
{
Debug.Log ("UIdown:" +selectGo.name);
}
return;
}
#endif
else
{
if (!canCalculateAbleAreaSize) return;
//Debug.Log ("射线检测");
ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, out hit)) {
//Debug.Log ("hitname" + hit.transform.name + " point:" + hit.point);
}
}
}
else if(Input.GetMouseButtonUp (0))
{
isClikingItem = false;
#if UNITY_IPHONE || UNITY_IOS
if (EventSystem.current.IsPointerOverGameObject (Input.GetTouch (0).fingerId)) {
Debug.Log ("IPHONEuioverUPUPUP");
GameObject selectGo = EventSystem.current.currentSelectedGameObject;
//Debug.Log ("selectGo");
if (selectGo != null) {
Debug.Log ("uioverUPUPUP:" + selectGo.name);
if (selectGo.name.Contains ("GridItem")) {
} else {
}
}
return;
}
#else
if (EventSystem.current.IsPointerOverGameObject ())
{
GameObject selectGo = EventSystem.current.currentSelectedGameObject;
//Debug.Log ("selectGo");
if (selectGo != null) {
Debug.Log ("uioverUPUPUP:" + selectGo.name);
if (selectGo.name.Contains ("GridItem")) {
}
else{
}
}
return;
}
#endif
else
{
if (!canCalculateAbleAreaSize) return;
}
}
ugui 点击在ui和非ui的判断
最新推荐文章于 2024-05-31 11:03:58 发布