一. 鼠标的基本事件(返回Bool值)
1. 按下事件:Input.GetMouseButtonDown()
例:if (Input.GetMouseButtonDown(0))
Debug.Log("按下鼠标左键");
2. 抬起事件:Input.GetMouseButtonUp()
例:if (Input.GetMouseButtonUp(1))
Debug.Log("抬起鼠标右键");
3. 长按事件:Input.GetMouseButton()
例:if (Input.GetMouseButton(2))
Debug.Log("长按鼠标中键");
注:事件参数0、1、2分别代表鼠标左键、右键和中键。
二. 鼠标虚拟轴
下拉菜单设置 Edit → Project Settings → Input