Eye Tracking 2D

Overview

The Tobii Eye Tracking SDK asset from the Unity Asset Store does not have native support for 2D GameObjects. We have created an Asset called 'Eye Tracking 2D' which is an extension of the Tobii Eye Tracking SDK. It uses data gathered from the Tobii Eye Tracking SDK API in order to enable eye tracking on 2D GameObjects. The package was originally created for our own project but, we are in the process of submitting the asset to the Unity Asset Store in the hope that other developers will make more 2D games that can be played solely using eye tracking.
The class diagrams for this package can be found here.

How It Works

Eye Tracking 2D includes 4 files. The GazeAware2d script contains an abstract class which has all the code used to register gaze input on GameObjects. The subclasses of this class must implement the following methods:
• gazeAction() This method is called when the user has successfully gazed at the object for longer amount than the gazeTime
• startedGazing() This method is called when the user starts to gaze at an object - good for implementing visual feedback for the user
• stoppedGazing() This method is called hen the user looks away from an object after they have started gazing at it

Developers can choose to create a subclass of this class themselves but the Eye Tracking 2D asset includes a subclass already called the GazeableObject script. There is an interface included in this asset (IGazeableObject) which must be implemented by a script and attached to the GameObject that needs to accept input via eye tracking. The GazeableObject uses this script in order for the eye tracking to work on that GameObject. All the developer needs to do in the end is to attach the GazeableObject script to the GameObject as well and it will now work with gaze inputs.

The last file in the asset is a script called UniformTimeGazeableObject. This script is like the GazeableObject script but the difference is that it will work the same when the Time.timescale value is changed within Unity. The standard GazeAware2d script uses the Update() method from the Monobehaviour class but this is affected by Time.timescale. For example, if there is a pause menu, Time.timescale will be set to 0 so the Update() method will not run. This is why the UniformTimeGazeableObject script exists. It is unaffected by Time.timescale so it can be used for GameObjects that still require gaze input even when the timescale has been changed.