2012-04-11 3 views

답변

3

이 항목이 원하는 내용이 아닙니까?

http://unity3d.com/support/documentation/ScriptReference/Input-mousePosition.html

** 수정 **

using UnityEngine; 

public class example : MonoBehaviour 
{ 
    void Update() 
    { 
     // Left-half of the screen. 
     Rect bounds = new Rect(0, 0, Screen.width/2, Screen.height); 
     if (Input.GetMouseButtonDown(0) && bounds.Contains(Input.mousePosition)) 
     { 
      Debug.Log("Left!");    
     } 
    } 
} 
+0

가 있지만 (0)하는이 –

+0

이 (편집)이 당신을 위해 작동 하는가 것을 클릭 왼쪽 마우스에 해당 Input.GetMouseButtonDown로 조절한다? – Lance

+1

y 마우스 위치에 대해 Screen.height - Input.mousePosition.y를 사용하기 전까지는이 작업이 저에게 효과적이지 않았습니다. 어떤 이유로 마우스의 원점이 왼쪽 하단에있는 반면 rect의 원점은 왼쪽 상단입니다. – SystemicPlural

관련 문제