Skip to content

Commit 6cffe7f

Browse files
Change Requests
1 parent f9dad98 commit 6cffe7f

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

Assets/MixedRealityToolkit-Examples/Demos/Boundary/Scripts/BoundaryVisualizationDemo.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.MixedReality.Toolkit.Core.Managers;
88
using Microsoft.MixedReality.Toolkit.Core.Utilities;
99
using System.Collections.Generic;
10+
using Microsoft.MixedReality.Toolkit.Core.Utilities.Async;
1011
using UnityEngine;
1112
using UnityEngine.Experimental.XR;
1213

@@ -68,14 +69,15 @@ private void Update()
6869
}
6970
}
7071

71-
private void OnEnable()
72+
private async void OnEnable()
7273
{
74+
await new WaitUntil(() => MixedRealityManager.BoundarySystem != null);
7375
MixedRealityManager.BoundarySystem.Register(gameObject);
7476
}
7577

7678
private void OnDisable()
7779
{
78-
MixedRealityManager.BoundarySystem.Unregister(gameObject);
80+
MixedRealityManager.BoundarySystem?.Unregister(gameObject);
7981
}
8082

8183
#endregion MonoBehaviour Implementation

Assets/MixedRealityToolkit-SDK/Features/Input/FocusProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.MixedReality.Toolkit.Core.Interfaces.InputSystem;
88
using Microsoft.MixedReality.Toolkit.Core.Managers;
99
using Microsoft.MixedReality.Toolkit.Core.Utilities;
10+
using Microsoft.MixedReality.Toolkit.Core.Utilities.Async;
1011
using Microsoft.MixedReality.Toolkit.Core.Utilities.Physics;
1112
using System;
1213
using System.Collections.Generic;
@@ -224,7 +225,7 @@ public override int GetHashCode()
224225

225226
#region MonoBehaviour Implementation
226227

227-
private void Awake()
228+
private async void Awake()
228229
{
229230
if (uiRaycastCamera == null)
230231
{
@@ -233,6 +234,8 @@ private void Awake()
233234
CreateUiRaycastCamera();
234235
}
235236

237+
await WaitUntilInputSystemValid;
238+
236239
foreach (var inputSource in MixedRealityManager.InputSystem.DetectedInputSources)
237240
{
238241
RegisterPointers(inputSource);
@@ -241,6 +244,8 @@ private void Awake()
241244

242245
private void Update()
243246
{
247+
if (MixedRealityManager.InputSystem == null) { return; }
248+
244249
UpdatePointers();
245250
UpdateFocusedObjects();
246251
}

Assets/MixedRealityToolkit-SDK/Features/Input/Handlers/TeleportHotSpot.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public override void OnBeforeFocusChange(FocusEventData eventData)
3030

3131
if (eventData.Pointer.IsInteractionEnabled)
3232
{
33-
MixedRealityManager.TeleportSystem.RaiseTeleportCanceled(eventData.Pointer, this);
34-
MixedRealityManager.TeleportSystem.RaiseTeleportRequest(eventData.Pointer, this);
33+
MixedRealityManager.TeleportSystem?.RaiseTeleportCanceled(eventData.Pointer, this);
34+
MixedRealityManager.TeleportSystem?.RaiseTeleportRequest(eventData.Pointer, this);
3535
}
3636
}
3737
else if (eventData.OldFocusedObject == gameObject)
@@ -40,7 +40,7 @@ public override void OnBeforeFocusChange(FocusEventData eventData)
4040

4141
if (eventData.Pointer.IsInteractionEnabled)
4242
{
43-
MixedRealityManager.TeleportSystem.RaiseTeleportCanceled(eventData.Pointer, this);
43+
MixedRealityManager.TeleportSystem?.RaiseTeleportCanceled(eventData.Pointer, this);
4444
}
4545
}
4646
}

Assets/MixedRealityToolkit-SDK/Features/UX/Scripts/Cursors/CursorModifier.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public Vector3 GetModifiedPosition(IMixedRealityCursor cursor)
165165
}
166166

167167
FocusDetails focusDetails;
168-
if (MixedRealityManager.InputSystem.FocusProvider.TryGetFocusDetails(cursor.Pointer, out focusDetails))
168+
if (MixedRealityManager.InputSystem != null && MixedRealityManager.InputSystem.FocusProvider.TryGetFocusDetails(cursor.Pointer, out focusDetails))
169169
{
170170
// Else, consider the modifiers on the cursor modifier, but don't snap
171171
return focusDetails.Point + HostTransform.TransformVector(CursorPositionOffset);

0 commit comments

Comments
 (0)