纳金网
标题: Unity3d 鼠标的事件 [打印本页]
作者: 刀锋狼 时间: 2015-1-28 01:20
标题: Unity3d 鼠标的事件
当鼠标按键按下时,返回一次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.”);
转载: 游戏开发网
作者: hisamekenji 时间: 2015-1-28 09:37
感谢分享~~~~~~~~~~~~~~
欢迎光临 纳金网 (http://rs.narkii.com/club/) |
Powered by Discuz! X2.5 |