로컬1 [Unity] 마우스 위치를 UI 요소의 로컬 좌표로 변환하기 RectTransformUtility 클래스의 ScreenPointToLocalPointInRectangle 함수로 쉽게 구할 수 있다. 함수의 구조는 아래와 같다. public static bool ScreenPointToLocalPointInRectangle(RectTransform rect, Vector2 screenPoint, Camera cam, out Vector2 localPoint) Image를 Canvas(1600x900)에 생성한 후, 아래의 코드를 적용하였다. using UnityEngine; public class RTUtil : MonoBehaviour { public RectTransform rt; private void Update() { if (RectTransformUtil.. 2023. 9. 28. 이전 1 다음