Skip to content

Commit cce7342

Browse files
Fixed an issue where Focus Provider was not registering pointers for input sources that were already detected when the Focus Manager starts.
1 parent d56eb4d commit cce7342

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,30 @@ private void Awake()
231231
"To create a UIRaycastCamera in your scene, find this Focus Provider GameObject and add one there.");
232232
CreateUiRaycastCamera();
233233
}
234+
235+
foreach (var inputSource in InputSystem.DetectedInputSources)
236+
{
237+
// If our input source does not have any pointers, then skip.
238+
if (inputSource.Pointers == null) { return; }
239+
240+
for (var i = 0; i < inputSource.Pointers.Length; i++)
241+
{
242+
RegisterPointer(inputSource.Pointers[i]);
243+
244+
// Special Registration for Gaze
245+
if (inputSource.SourceId == InputSystem.GazeProvider.GazeInputSource.SourceId)
246+
{
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);
255+
}
256+
}
257+
}
234258
}
235259

236260
private void Update()

0 commit comments

Comments
 (0)