Skip to content

Commit 78e3eda

Browse files
committed
Temper the "VR Controller Absent" Error
1 parent b92df97 commit 78e3eda

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Assets/Plugins/LeapMotion/Modules/InteractionEngine/Scripts/InteractionXRController.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,7 @@ public override List<Vector3> graspManipulatorPoints {
696696
private bool _graspButtonDown = false;
697697
private bool _graspButtonUp = false;
698698
private float _graspButtonDownSlopTimer = 0F;
699+
private bool _inputWarningDisplayed = false;
699700

700701
public override Vector3 GetGraspPoint() {
701702
return graspPoint.transform.position;
@@ -731,7 +732,12 @@ private void fixedUpdateGraspButtonState(bool ignoreTemporal = false) {
731732
try {
732733
graspButton = Input.GetAxis(graspButtonAxis) > graspDepressedValue;
733734
} catch {
734-
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.");
735+
if (!_inputWarningDisplayed) {
736+
Debug.LogWarning("VR CONTROLLER INPUT AXES ARE NOT SET UP. Go to your Input Manager " +
737+
"and add a definition for " + graspButtonAxis + " on the " + (isLeft ? "9" : "10") + "th " +
738+
"Joystick Axis or disable this controller.", this);
739+
_inputWarningDisplayed = true;
740+
}
735741
graspButton = Input.GetKey(isLeft ? KeyCode.JoystickButton14: KeyCode.JoystickButton15);
736742
}
737743
}
@@ -756,7 +762,12 @@ private void fixedUpdateGraspButtonState(bool ignoreTemporal = false) {
756762
try {
757763
graspButton = Input.GetAxis(graspButtonAxis) > graspDepressedValue;
758764
} catch {
759-
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.");
765+
if (!_inputWarningDisplayed) {
766+
Debug.LogWarning("VR CONTROLLER INPUT AXES ARE NOT SET UP. Go to your Input Manager " +
767+
"and add a definition for " + graspButtonAxis + " on the " + (isLeft ? "9" : "10") + "th " +
768+
"Joystick Axis or disable this controller.", this);
769+
_inputWarningDisplayed = true;
770+
}
760771
graspButton = Input.GetKey(isLeft ? KeyCode.JoystickButton14 : KeyCode.JoystickButton15);
761772
}
762773
}

0 commit comments

Comments
 (0)