Input.GetMouseButtonDown()语法
public static bool GetMouseButtonDown(int button);
Input.GetMouseButtonDown()用法描述
Returns true during the frame the user pressed the given mouse button.
与Input.GetMouseButton()区别:参考文章
- Input.GetMouseButtonDown()会给出每一帧中鼠键是否被按下(因为这个值在每一帧中都会被重置),必须在update()方法中调用该方法。
- 鼠键按下并释放时才会返回true。和Input.GetMouseButtonUp()方法刚好相反
- 只要鼠键被按下,则Input.GetMouseButton()会连续返回true(即不会在帧之间被重置)
button values are 0 for left button,
1 for right button,
2 for the middle button.