로딩
티스토리 데이터 처리 중입니다.

유니티 C# 마우스로 3D 오브젝트 클릭 간단 구현 Mouse Ray cast

 유니티 C# 마우스로 3D 오브젝트 클릭 간단 구현 Mouse Ray cast

코드 작성레이 캐스트를 활용합니다using UnityEngine;public class TouchEvent : MonoBehaviour { void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { Debug.Log("터치된 오브젝트: " + hit.transform.name); } .....