c# 강의/유니티

▶ 마우스 이벤트

쪼혀 2020. 5. 11. 22:39
public class ExampleClass : MonoBehaviour {
    void Update() { 
        //  0, 1, 2에 따라 마우스 [왼쪽버튼], [오른쪽버튼], [휠버튼]

        if (Input.GetMouseButton (0))
            Debug.Log("마우스 버튼을 누르는 동안");
        
        if (Input.GetMouseButtonDown (1))
            Debug.Log("마우스 버튼을 누른 순간");
        
        if (Input.GetMousebuttonUp (2))
            Debug.Log("마우스 버튼을 눌렀다 때는 순간.");
     // Input.mousePositio  마우스 클릭한 좌표값 얻을수 있음
    }
}