Skip to content

Commit 1ac8e87

Browse files
Merge branch 'mrtk_development' into vNEXT-SpatialMouse
2 parents 595ae63 + b7aa674 commit 1ac8e87

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,6 @@ protected virtual void UpdateCursorTransform()
316316
{
317317
Debug.LogError($"{name}: Unable to get focus details for {pointer.GetType().Name}!");
318318
}
319-
else if (pointer.GetType() != typeof(TouchPointer))
320-
{
321-
Debug.LogWarning($"{pointer.GetType().Name} not registered!");
322-
}
323319

324320
return;
325321
}

Assets/MixedRealityToolkit-SDK/Features/UX/Scripts/Pointers/BaseControllerPointer.cs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using Microsoft.MixedReality.Toolkit.Core.Managers;
1414
using Microsoft.MixedReality.Toolkit.SDK.Input.Handlers;
1515
using System.Collections;
16+
using Microsoft.MixedReality.Toolkit.Core.Utilities.Async;
1617
using UnityEngine;
1718

1819
namespace Microsoft.MixedReality.Toolkit.SDK.UX.Pointers
@@ -61,7 +62,7 @@ public abstract class BaseControllerPointer : ControllerPoseSynchronizer, IMixed
6162

6263
protected bool IsTeleportRequestActive = false;
6364

64-
private bool lateRegisterTeleport = false;
65+
private bool lateRegisterTeleport = true;
6566

6667
/// <summary>
6768
/// The forward direction of the targeting ray
@@ -119,31 +120,21 @@ protected override void OnEnable()
119120
SetCursor();
120121
BaseCursor?.SetVisibility(true);
121122

122-
if (TeleportSystem == null)
123-
{
124-
lateRegisterTeleport = true;
125-
}
126-
else if (!lateRegisterTeleport)
123+
if (MixedRealityManager.IsInitialized && TeleportSystem != null && !lateRegisterTeleport)
127124
{
128125
TeleportSystem.Register(gameObject);
129126
}
130127
}
131128

132-
protected override void Start()
129+
protected override async void Start()
133130
{
134131
base.Start();
135132

136133
if (lateRegisterTeleport)
137134
{
138-
if (TeleportSystem == null)
139-
{
140-
Debug.LogError("Failed to find the Teleport System!");
141-
}
142-
else
143-
{
144-
lateRegisterTeleport = false;
145-
TeleportSystem.Register(gameObject);
146-
}
135+
await new WaitUntil(() => TeleportSystem != null);
136+
lateRegisterTeleport = false;
137+
TeleportSystem.Register(gameObject);
147138
}
148139
}
149140

Assets/MixedRealityToolkit-SDK/Features/UX/Scripts/Pointers/TeleportPointer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public override void OnPositionInputChanged(InputEventData<Vector2> eventData)
290290
{
291291
teleportEnabled = true;
292292

293-
TeleportSystem.RaiseTeleportRequest(this, TeleportHotSpot);
293+
TeleportSystem?.RaiseTeleportRequest(this, TeleportHotSpot);
294294
}
295295
else if (canMove)
296296
{
@@ -356,15 +356,15 @@ public override void OnPositionInputChanged(InputEventData<Vector2> eventData)
356356
if (TeleportSurfaceResult == TeleportSurfaceResult.Valid ||
357357
TeleportSurfaceResult == TeleportSurfaceResult.HotSpot)
358358
{
359-
TeleportSystem.RaiseTeleportStarted(this, TeleportHotSpot);
359+
TeleportSystem?.RaiseTeleportStarted(this, TeleportHotSpot);
360360
}
361361
}
362362

363363
if (teleportEnabled)
364364
{
365365
canTeleport = false;
366366
teleportEnabled = false;
367-
TeleportSystem.RaiseTeleportCanceled(this, TeleportHotSpot);
367+
TeleportSystem?.RaiseTeleportCanceled(this, TeleportHotSpot);
368368
}
369369
}
370370

0 commit comments

Comments
 (0)