Skip to content

Commit

Permalink
Temper the "VR Controller Absent" Error
Browse files Browse the repository at this point in the history
  • Loading branch information
zalo committed Jan 19, 2021
1 parent b92df97 commit 78e3eda
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ public override List<Vector3> graspManipulatorPoints {
private bool _graspButtonDown = false;
private bool _graspButtonUp = false;
private float _graspButtonDownSlopTimer = 0F;
private bool _inputWarningDisplayed = false;

public override Vector3 GetGraspPoint() {
return graspPoint.transform.position;
Expand Down Expand Up @@ -731,7 +732,12 @@ private void fixedUpdateGraspButtonState(bool ignoreTemporal = false) {
try {
graspButton = Input.GetAxis(graspButtonAxis) > graspDepressedValue;
} catch {
Debug.LogError("INPUT AXIS NOT SET UP. Go to your Input Manager and add a definition for " + graspButtonAxis + " on the " + (isLeft ? "9" : "10") + "th Joystick Axis.");
if (!_inputWarningDisplayed) {
Debug.LogWarning("VR CONTROLLER INPUT AXES ARE NOT SET UP. Go to your Input Manager " +
"and add a definition for " + graspButtonAxis + " on the " + (isLeft ? "9" : "10") + "th " +
"Joystick Axis or disable this controller.", this);
_inputWarningDisplayed = true;
}
graspButton = Input.GetKey(isLeft ? KeyCode.JoystickButton14: KeyCode.JoystickButton15);
}
}
Expand All @@ -756,7 +762,12 @@ private void fixedUpdateGraspButtonState(bool ignoreTemporal = false) {
try {
graspButton = Input.GetAxis(graspButtonAxis) > graspDepressedValue;
} catch {
Debug.LogError("INPUT AXIS NOT SET UP. Go to your Input Manager and add a definition for " + graspButtonAxis + " on the " + (isLeft ? "9" : "10") + "th Joystick Axis.");
if (!_inputWarningDisplayed) {
Debug.LogWarning("VR CONTROLLER INPUT AXES ARE NOT SET UP. Go to your Input Manager " +
"and add a definition for " + graspButtonAxis + " on the " + (isLeft ? "9" : "10") + "th " +
"Joystick Axis or disable this controller.", this);
_inputWarningDisplayed = true;
}
graspButton = Input.GetKey(isLeft ? KeyCode.JoystickButton14 : KeyCode.JoystickButton15);
}
}
Expand Down

0 comments on commit 78e3eda

Please sign in to comment.