Skip to content

Commit

Permalink
Reduce Eye Tracking Logs (#175)
Browse files Browse the repository at this point in the history
* Reduce spam

* Start true to catch first eye tracking failure

* Indentation
  • Loading branch information
marlenaklein-msft authored Mar 18, 2024
1 parent d9f04d9 commit 04679a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion BasicSample/Assets/Interaction/Scripts/FollowEyeGaze.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class FollowEyeGaze : MonoBehaviour
private InputDevice eyeTrackingDevice = default(InputDevice);
private Renderer materialRenderer = null;
private Material trackedMaterial = null;
private bool wasEyeTrackingValidLastFrame = true;

/// <summary>
/// Toggles the enabled state of this script to actively follow eye gaze or not.
Expand Down Expand Up @@ -44,10 +45,15 @@ private void Update()

if (!eyeTrackingDevice.isValid)
{
Debug.LogWarning($"Unable to acquire eye tracking device. Have permissions been granted?");
if (wasEyeTrackingValidLastFrame)
{
Debug.LogWarning($"Unable to acquire eye tracking device. Have permissions been granted?");
}
wasEyeTrackingValidLastFrame = false;
return;
}
}
wasEyeTrackingValidLastFrame = true;

// Gets gaze data from the device.
bool hasData = eyeTrackingDevice.TryGetFeatureValue(CommonUsages.isTracked, out bool isTracked);
Expand Down

0 comments on commit 04679a3

Please sign in to comment.