Skip to content

Commit f33d9bc

Browse files
cleaner gaze registration
1 parent cce7342 commit f33d9bc

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

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

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,9 @@ private void Awake()
242242
RegisterPointer(inputSource.Pointers[i]);
243243

244244
// Special Registration for Gaze
245-
if (inputSource.SourceId == InputSystem.GazeProvider.GazeInputSource.SourceId)
245+
if (inputSource.SourceId == InputSystem.GazeProvider.GazeInputSource.SourceId && gazeProviderPointingData == null)
246246
{
247-
Debug.Assert(gazeProviderPointingData == null, "Gaze Provider Pointer Data was already registered!");
248-
249-
if (gazeProviderPointingData == null)
250-
{
251-
gazeProviderPointingData = new PointerData(inputSource.Pointers[i]);
252-
}
253-
254-
Debug.Assert(gazeProviderPointingData != null);
247+
gazeProviderPointingData = new PointerData(inputSource.Pointers[i]);
255248
}
256249
}
257250
}
@@ -850,16 +843,9 @@ public void OnSourceDetected(SourceStateEventData eventData)
850843
RegisterPointer(eventData.InputSource.Pointers[i]);
851844

852845
// Special Registration for Gaze
853-
if (eventData.InputSource.SourceId == InputSystem.GazeProvider.GazeInputSource.SourceId)
846+
if (eventData.InputSource.SourceId == InputSystem.GazeProvider.GazeInputSource.SourceId && gazeProviderPointingData == null)
854847
{
855-
Debug.Assert(gazeProviderPointingData == null, "Gaze Provider Pointer Data was already registered!");
856-
857-
if (gazeProviderPointingData == null)
858-
{
859-
gazeProviderPointingData = new PointerData(eventData.InputSource.Pointers[i]);
860-
}
861-
862-
Debug.Assert(gazeProviderPointingData != null);
848+
gazeProviderPointingData = new PointerData(eventData.InputSource.Pointers[i]);
863849
}
864850
}
865851
}

0 commit comments

Comments
 (0)