判定控制器按键是否触发抬起动作,当ButtonType为ButtonConfirm时,兼容HUAWEI VR 1.0的触摸板单击功能;当ButtonType为ButtonBack时,兼容HUAWEI VR 1.0的返回按键抬起功能。
Parameter Name |
Parameter Type |
Description |
|---|---|---|
button |
ButtonType 细节详见 2.1.4.1 "ButtonType" |
控制器按键的类型,ButtonType |
if (null == controller) {
Debug.LogError("Controller is null");
} else {
if (controller.IsButtonPressed(ButtonType.ButtonConfirm)) {
Debug.Log("Confirm button is pressed!");
}
if (controller.IsButtonDown(ButtonType.ButtonConfirm)) {
Debug.Log("Confirm button is pressed down!");
}
if (controller.IsButtonUp(ButtonType.ButtonConfirm)) {
Debug.Log("Confirm button is pressed up!");
}
}