UnityEngine.EventSystems.EventSystem.IsPointerOverGameObject C# (CSharp) Method

IsPointerOverGameObject() public method

public IsPointerOverGameObject ( ) : bool
return bool
        public bool IsPointerOverGameObject()
        {
            return this.IsPointerOverGameObject(-1);
        }

Same methods

EventSystem::IsPointerOverGameObject ( int pointerId ) : bool

Usage Example

コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        UnityEngine.EventSystems.EventSystem eventSystem = UnityEngine.EventSystems.EventSystem.current;

#if UNITY_ANDROID && !UNITY_EDITOR
        PreviousFrameTouch    = ThisFrameTouch;
        PreviousTouchPosition = TouchPosition;
        if (Input.touchCount > 0)
        {
            if (!eventSystem.IsPointerOverGameObject())
            {
                if (!_inputUILock)
                {
                    TouchPosition  = Input.touches[0].position;
                    ThisFrameTouch = true;
                }
            }
            else
            {
                _inputUILock = true;
            }
        }
        else
        {
            ThisFrameTouch = false;
            _inputUILock   = false;
        }
#else
        PreviousFrameTouch    = ThisFrameTouch;
        PreviousTouchPosition = TouchPosition;
        if (Input.GetMouseButton(0))
        {
            if (!eventSystem.IsPointerOverGameObject())
            {
                if (!_inputUILock)
                {
                    TouchPosition  = Input.mousePosition;
                    ThisFrameTouch = true;
                }
            }
            else
            {
                _inputUILock = true;
            }
        }
        else
        {
            _inputUILock   = false;
            ThisFrameTouch = false;
        }
#endif
    }
All Usage Examples Of UnityEngine.EventSystems.EventSystem::IsPointerOverGameObject