Notice
Recent Posts
Recent Comments
Link
«   2025/09   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

코딩 노트

[Unity] UI 위에서 발생한 Input인지 체크하기 본문

DevMemo/Etc

[Unity] UI 위에서 발생한 Input인지 체크하기

youn_ 2017. 1. 6. 17:52

참조 : 

http://answers.unity3d.com/questions/967170/detect-if-pointer-is-over-any-ui-element.html



EventSystems.EventSystem.IsPointerOverGameObject


위의 함수를 사용해서 아래와 같이 만들어 둡니다. 

static public bool isOverUI

    {

        get

        {

            if (_eventSystem == null)

                return false;


            return _eventSystem.IsPointerOverGameObject();

        } 

    }


예를들어 게임 화면의 줌인/줌아웃이, UI Scroll View에서 휠을 사용할때 발생할 경우 

위와 같이 체크하여 사용합니다.


NGUI의 UICamera.isOverUI와 비슷하게 사용합니다.