[Unity] IsPointerOverGameObject - UI 와 게임 오브젝트 클릭을 구분하기


[Unity] IsPointerOverGameObject - UI 와 게임 오브젝트 클릭을 구분하기

EventSystem.current.IsPointerOverGameObject() UI 가 클릭되면 참을 반환합니다 괄호안에 매개변수 없이 사용하면 마우스 왼클릭으로 인식합니다 예시) using UnityEngine; using System.Collections; using UnityEngine.EventSystems; public class MouseExample : MonoBehaviour { void Update() { // Check if the left mouse button was clicked if (Input.GetMouseButtonDown(0)) { // Check if the mouse was clicked over a UI element if (EventSystem.current.IsPointerOverGameObject()) { Debug.Log("Clicked on the UI"); } } } }...


#Unity #유니티

원문링크 : [Unity] IsPointerOverGameObject - UI 와 게임 오브젝트 클릭을 구분하기