FOR DEVELOPERS

Explore developer resources

Build. Integrate. Innovate. Learn how easy it is to transform your products and solutions with AI-powered eye-tracking from HarmonEyes.

Overview & Getting Started

Overview

The HarmonEyes Unity SDK turns raw eye-tracking data from a supported headset or webcam into four real-time cognitive-state metrics: Mental Workload, Fatigue, Attention, and Mental Readiness. The SDK is delivered as a Unity package that ships a native theia library, a C# wrapper, three platform sample scenes (Meta Quest Pro, HTC Vive Focus Vision, and a headset-free Mock playback), and editor scripts for inspector ergonomics.

What it produces

MetricLevelsCadenceKey payload fields
Mental WorkloadLow / Moderate / Highper native batch (~1 s)level, confidence, prob_high, batch_number
FatigueAlert / Neither / RatherDrowsy / Drowsyper native batch (~1 s)level, confidence, batch_number, ttt_level, ttt_minutes
AttentionNarrow / Mod-Narrow / Neither / Mod-Broad / Broadcontinuous, advances with fixation/saccade observationslevel, label, composite_score, total_observations
Mental Readinesslow % / moderate % / high %once minimum session length is metlow_percentage, moderate_percentage, high_percentage, total_predictions

See API Reference for the per-field type and range.

Real-world use cases

  • Reading performance — line-by-line attention tracking, comprehension monitoring, detecting reading-difficulty patterns.
  • Clinical diagnostics — screening for Parkinson’s, TBI, Lyme disease, MCI, MS via eye-movement biomarkers.
  • Visual search and driving — monitoring attention, decision-making, situational awareness.
  • Biometric ID — eye-movement signatures for real-time user authentication.
  • Developer testing — user testing during app development.
  • Market research — interface usability and user-behavior insight.

Supported hardware

TrackerNative presetSample scene
Meta Quest ProQuest (72 Hz)Meta Quest Pro Sample
HTC Vive Focus VisionQuest preset (closest available match)Vive Focus Vision Sample
Pupil Labs NeonPupilLabs (200 Hz)Mock Tracker Sample (CSV playback)
Webcam-based desktop trackersWebcam (30 Hz)
GanzinGanzin (60 Hz)

*to set up any eye tracker not listed, select the nearest lower Hz preset from this list

Get a license key

A license key is required. Contact sales@harmoneyes.com to obtain one. The same key is entered on the AnalyzeEyeTrackingData component in each sample scene.

Three ways to use the SDK

Pick whichever matches your situation.

PathWhen to useSee
Headset sampleYou have a Meta Quest Pro or Vive Focus Vision and want a working scene out of the box.Meta Quest Pro Sample.md / Vive Focus Vision Sample.md
Headset-free Mock playbackYou don’t have a headset, or you want to test against a recorded CSV.Unity SDK Install.md → Mock Tracker section
Write a gaze data collection and submission script for your trackerYour platform isn’t covered by the bundled samples or has a more complex setupManual Integration Overview(below) / Sample code / API Reference.md

Manual Integration Overview

A custom integration is three steps.

1. Initialise

  • Add the AnalyzeEyeTrackingData component to a GameObject in your scene.
  • Enter the License Key on the component inspector.
  • Pick the Tracker preset that matches your hardware (or the closest sample-rate match, rounding down).

The component handles native SDK creation, license validation, and session start automatically on Start. Read AnalyzeEyeTrackingData.Instance.EyeTrackingInitCompleted to know when initialisation has completed.

2. Capture — submit one sample per tracker frame

Write a collector MonoBehaviour that reads your platform’s eye data, builds a Sample via the factory, and submits it.

using UnityEngine;
using HarmonEyes.EyeTracking.Common;

public class MyCollector : MonoBehaviour
{
    [SerializeField] private Camera headCamera;

    void FixedUpdate()
    {
        var analyze = AnalyzeEyeTrackingData.Instance;
        if (analyze == null || !analyze.EyeTrackingInitCompleted) return;

        long timestampNs = (long)(Time.timeAsDouble * 1e9);

        // Pull per-eye origin, orientation, closed-weight, and a blink decision
        // from your platform's API.
        Vector3    leftEyeOrigin       = /* head-local metres */ Vector3.zero;
        Quaternion leftEyeOrientation  = /* gaze rotation */ Quaternion.identity;
        float      leftEyeClosed       = /* 0..1 */ 0f;
        Vector3    rightEyeOrigin      = Vector3.zero;
        Quaternion rightEyeOrientation = Quaternion.identity;
        float      rightEyeClosed      = 0f;
        bool       isBlinking          = /* your platform's blink criterion */ false;

        Sample s = GazeDataSampleFactory.CreateGazeSample(
            analyze.SessionId, timestampNs,
            leftEyeOrigin,  leftEyeOrientation,  leftEyeClosed,
            rightEyeOrigin, rightEyeOrientation, rightEyeClosed,
            headCamera.fieldOfView,
            isBlinking);

        analyze.SubmitGazeSample(s);
    }
}

3. Process — read results

Two access patterns. Pick whichever fits your code.

Polling — read the latest payload on demand:

var mw = analyze.EyeTrackingAnalyzer.CurrentMentalWorkload;
if (mw != null) Debug.Log($"MW: {mw.LevelName} (conf {mw.confidence:F2})");

Event-driven — subscribe once, react to each new prediction:

analyze.EyeTrackingAnalyzer.OnMentalWorkloadResult += mw =>
    Debug.Log($"MW: {mw.LevelName} (conf {mw.confidence:F2})");

The four result properties and matching events are listed in API Reference.

Where to go next

GoalLink
Install the SDK and run the headset-free Mock sampleUnity SDK Install
Run the Meta Quest Pro sampleMeta Quest Pro Sample
Run the Vive Focus Vision sampleVive Focus Vision Sample
Full public-API reference (components, factory, results, events, native wrappers)API Reference