유니티 C# 마우스로 오브젝트 클릭 간단 구현


유니티 C# 마우스로 오브젝트 클릭 간단 구현

코드 작성 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); } } } } 참고할만한 글 유니티 C# 마우스 좌표 Mouse Position 간단 구하기 코드 작성 using System.Collections; using System.Collections.Generic; us..


원문링크 : 유니티 C# 마우스로 오브젝트 클릭 간단 구현