From 78e3eda032dffa2c50812fe2089547ab906f8cd6 Mon Sep 17 00:00:00 2001 From: Johnathon Selstad Date: Tue, 19 Jan 2021 14:03:04 -0800 Subject: [PATCH] Temper the "VR Controller Absent" Error --- .../Scripts/InteractionXRController.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Assets/Plugins/LeapMotion/Modules/InteractionEngine/Scripts/InteractionXRController.cs b/Assets/Plugins/LeapMotion/Modules/InteractionEngine/Scripts/InteractionXRController.cs index 2f8d78bbca..36cc507bf0 100644 --- a/Assets/Plugins/LeapMotion/Modules/InteractionEngine/Scripts/InteractionXRController.cs +++ b/Assets/Plugins/LeapMotion/Modules/InteractionEngine/Scripts/InteractionXRController.cs @@ -696,6 +696,7 @@ public override List 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; @@ -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); } } @@ -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); } }