:::::: STUDY ::::::/Unity

Preventing uGUI mouse click from passing through GUI controls

GrayCrow 2016. 6. 23. 23:33

Preventing uGUI mouse click from passing through GUI controls



- 버튼을 클릭 했을때 그 밑에 object collider가 있으면 둘 다 클릭이 된다.

그 이유는 이벤트가 object 먼저하고 GUI로 넘어오기 때문.
http://docs.unity3d.com/kr/current/Manual/ExecutionOrder.html

FixedUpdate->OnTriggerXXXX-> OnColliderXXXX-> OnMouseXXXX->Update->GUI event
간단하게 설명하자면
Physics -> input event -> game logic -> GUI 순으로 실행이 됨.

이걸 해결 하기 위해서는 

Preventing uGUI mouse click from passing through GUI controls

http://forum.unity3d.com/threads/preventing-ugui-mouse-click-from-passing-through-gui-controls.272114/

링크 참조~


간단하게 설명하자면

eventSystem.IsPointerOverGameObject()

사용하면 GUI부터 체크함.