Skip to content

Commit 01655fe

Browse files
committed
Fixing up some scripts running in-editor / with HMD / etc
1 parent 3e4ebe9 commit 01655fe

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

Assets/HoloToolkit/Input/Scripts/EditorInputSelector.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,15 @@ public class EditorInputSelector : MonoBehaviour
2929

3030
private void Awake()
3131
{
32+
#if UNITY_EDITOR
3233
if (UnityEngine.XR.XRDevice.isPresent)
3334
{
35+
#endif
3436
Destroy(gameObject);
37+
return;
38+
#if UNITY_EDITOR
3539
}
40+
#endif
3641

3742
Inputs = new List<GameObject>();
3843

Assets/HoloToolkit/Input/Scripts/InputSources/GamepadInput.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected override void Start()
6464
if (inputManager == null)
6565
{
6666
Debug.LogError("Ensure your scene has the InputManager prefab.");
67-
gameObject.SetActive(false);
67+
Destroy(this);
6868
}
6969
}
7070

@@ -156,30 +156,26 @@ private void HandleGamepadAReleased()
156156
{
157157
case GestureState.NavigationStarted:
158158
navigationCompleted = true;
159-
Debug.Log("Gamepad: Navigation Completed");
160159
CancelInvoke("HandleHoldStarted");
161160
CancelInvoke("HandleHoldCompleted");
162161
inputManager.RaiseNavigationCompleted(this, GamePadId, Vector3.zero);
163162
Reset();
164163
break;
165164

166165
case GestureState.HoldStarted:
167-
Debug.Log("Gamepad: Hold Canceled");
168166
CancelInvoke("HandleHoldCompleted");
169167
inputManager.RaiseHoldCanceled(this, GamePadId);
170168
Reset();
171169
break;
172170

173171
case GestureState.HoldCompleted:
174-
Debug.Log("Gamepad: Hold Completed");
175172
inputManager.RaiseHoldCompleted(this, GamePadId);
176173
Reset();
177174
break;
178175

179176
default:
180177
CancelInvoke("HandleHoldStarted");
181178
CancelInvoke("HandleHoldCompleted");
182-
Debug.Log("Gamepad: Tap");
183179
inputManager.RaiseInputClicked(this, GamePadId, InteractionSourcePressType.Select, 1);
184180
Reset();
185181
break;
@@ -205,7 +201,6 @@ private void HandleHoldStarted()
205201
holdStarted = true;
206202

207203
currentGestureState = GestureState.HoldStarted;
208-
Debug.Log("Gamepad: Hold Started");
209204
inputManager.RaiseHoldStarted(this, GamePadId);
210205
raiseOnce = true;
211206

Assets/HoloToolkit/Input/Scripts/Utilities/ManualGazeControl.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,16 @@ public class ManualGazeControl : MonoBehaviour
3434

3535
private void Awake()
3636
{
37-
#if !UNITY_EDITOR
38-
Destroy(this);
37+
#if UNITY_EDITOR
38+
if (UnityEngine.XR.XRDevice.isPresent)
39+
{
40+
#endif
41+
Destroy(this);
42+
return;
43+
#if UNITY_EDITOR
44+
}
3945
#endif
46+
4047
cameraTransform = GetComponent<Camera>().transform;
4148
if (cameraTransform == null)
4249
{
@@ -55,7 +62,6 @@ private void Awake()
5562
JoystickXYRotationAxisControl.enabled = JoystickSupported;
5663
JoystickXYTranslationAxisControl.enabled = JoystickSupported;
5764
JoystickXZTranslationAxisControl.enabled = JoystickSupported;
58-
5965
}
6066

6167
private void Update()

0 commit comments

Comments
 (0)