当鼠标按键按下时,返回一次true,后面参数0是左键,1是右键,2是中键if(Input.GetMouseButtonDown(0)) Debug.Log("Pressed left click."); if(Input.GetMouseButtonDown(1)) Debug.Log("Pressed right click."); if(Input.GetMouseButtonDown(2)) Debug.Log("Pressed middle click.");
当鼠标按键按下时,返回true,可能多次,根据你鼠标按下的时间 ,后面参数0是左键,1是右键,2是中键
if(Input.GetMouseButton(0)) Debug.Log("Pressed left click."); if(Input.GetMouseButton(1)) Debug.Log("Pressed right click."); if(Input.GetMouseButton(2)) Debug.Log("Pressed middle click.");
当鼠标按键按下后弹起时,返回一次true,后面参数0是左键,1是右键,2是中键if(Input.GetMouseButtonUp(0)) Debug.Log("Pressed left click."); if(Input.GetMouseButtonUp(1)) Debug.Log("Pressed right click."); if(Input.GetMouseButtonUp(2)) Debug.Log("Pressed middle click.");
Unity3d 鼠标的事件GetMouseButtonDown()、GetMouseButton()、GetMouseButtonUp()
原文:http://blog.csdn.net/a350203223/article/details/41018983