Home › Forums › Eye Tracking Devices › Eye tracker 4C- Can I get the eye tracker name in Unity using C#? › Reply To: Eye tracker 4C- Can I get the eye tracker name in Unity using C#?
23/10/2018 at 09:45 #8943
Alex [Tobii]
Participant
Hi @supriya !
Unfortunately, there’s no such a feature in the public API of Tobii Unity SDK.
Underlying code will use the tracker that tracks a monitor, which game window is currently on.
There’s some undocumented code in the underlying API though, but it’s subject to change, so use it on your own risk.
Please look at
\Assets\Tobii\Framework\Internal\TobiiHost.cs
private void TrackWindow()
...
TobiiGameIntegrationApi.TrackWindow(_gameViewBoundsProvider.Hwnd);
This one tells which window to track. You can also track certain rectangle or tracker by url
and
public DisplayInfo DisplayInfo
...
var trackerInfo = TobiiGameIntegrationApi.GetTrackerInfo();
This one provides info about current tracker
To enumerate all connected trackers:
TobiiGameIntegrationApi.UpdateTrackerInfos();
List<TrackerInfo> trackerInfos;
var timeout = Stopwatch.StartNew();
while ((trackerInfos = TobiiGameIntegrationApi.GetTrackerInfos()).IsNull())
{
if (timeout.ElapsedMilliseconds > 10000)
{
throw new Exception("TGI error. Could not enumerate trackers.");
}
}