判断是否存在UI被触摸

        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("非触摸");
        }

 

posted @ 2018-12-10 16:04  81192  阅读(245)  评论(0编辑  收藏  举报