UI에 대한 Unity 판단 코드

3877 단어 UGUIunity
public bool IsPointUI()
    {
        bool isPointUI = false;

        if (Input.GetMouseButtonDown(0)
            || Input.GetMouseButton(0)
            || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began))
        {

#if (UNITY_ANDROID || UNITY_IPHONE) && !UNITY_EDITOR
            if (UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
#else
            if (UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject())
#endif
                //Debug.Log("     UI ");
                isPointUI = true;
            //else
            //    Debug.Log("       UI ");
        }

        return isPointUI;
    }

좋은 웹페이지 즐겨찾기