Closed RashKash103 closed 3 years ago
Seems like this issue is due to a negative interaction between the eye tracker and the Microsoft.MixedReality.QR NuGet package that is used to scan QR codes on the HoloLens device. When the QR code reader is initialized early on (presumably before or immediately after the eye tracker initializes), the eye tracker stops working as soon as the reader is is closed. The intermittent behavior was presumably due to timing differences and the order of execution when the Unity application was starting up.
To fix this issue, I added a yield return new WaitForSeconds(5f)
before calling QRCodeWatcher.Start()
. Since this addition, the eye tracker has been working 100% reliably.
Describe the bug
Eye tracking does not work consistently for the Microsoft HoloLens 2. The same exact code seems to work sometimes but does not work most of the time. For example, the application may work completely fine when run once, but half an hour later, the eye tracking stops working until, perhaps, the next day. To be clear, this only affects the application itself. To my knowledge, the eye tracking within the OS outside of the application is unaffected.
Edit: After some further experimentation, I stumbled across the
WindowsMixedRealityEyeGazeDataProvider.cs
file. The appropriate function is the one below. It seems that in the linevar eyes = pointerPose.Eyes
,eyes
gets set tonull
, thus not continuing into theif (eyes != null)
statement. From the documentation, it appears that thisSpatialPointerPose.Eyes
would returnnull
if on an unsupported device, but the HoloLens 2 device definitely supports eye tracking.To reproduce
Code to reproduce the behavior:
Expected behavior
Within the
while
loop, I expectCoreServices.InputSystem.EyeGazeProvider.IsEyeTrackingDataValid
to betrue
and the eye tracking to be working as expected.What I've Tried
EyeTracker
classYour setup
Unity Version 2019.3.15f1
MRTK Version 2.4.0
Gaze Input is enabled in the manifest
The eye tracking permission for the app is enabled in HoloLens 2 settings
The
Windows Mixed Reality Eye Gaze Provider
is added as an input provider in theMixedRealityToolkit
componentTarget platform
Additional context
Interestingly, this code has worked pretty reliably in the past in the same project. Other, unrelated code has been added to the project but that could not have broken the eye tracking as it has remained untouched for some time.
Additionally, for our use case, falling back to head-based gaze tracking is not an option!