Quick Start (Unity)
Supported Environment
-
The recommended Unity editor version is
2019.x. -
Minimum supported Android API level is
23. -
Target Android API level is
30. -
Minimum supported iOS Version is
11.0. -
Minimum Xcode version is
13.3. -
Camera permission,Network permissionandNetwork connected environmentare required. -
Build target to REAL DEVICEduring the development process.
SeeSo SDK uses the front camera of the device
- For best performance, must check target architectures
ARM64(Android/iOS) and select Scripting Backend toIL2CPP(Android only).
Sample Project
Please go to the sample project page for the purpose of using it rather than implementing it.
Environment Set-ups
- Check the Development key.
- Check the SeeSo Unity package.
- Check the unity editor has recommended version.
- Check the Android Build Support module installation.
- Check the iOS Build Support module installation.
Sample App Implementation
-
Create the new unity project from unity editor.

-
Import the SeeSo Unity package to the project.

-
Implement
initGazeTrackerfunction in theStart()function to initializeGazeTrackerimmediately when the application is launched.-
The first factor of the
initGazeTrackerfunction is the development key generated from the SeeSo Console. -
The second factor of the
initGazeTrackerfunction is theinitializationCallback.onInitializeddelegate, to check the initialization result.
// Start is called before the first frame update
void Start()
{
GazeTracker.initGazeTracker("YOUR_DEVELOPMENT_LICENSE_KEY", onInitialized);
}
void onInitialized(InitializationErrorType error)
{
if (error == InitializationErrorType.ERROR_NONE)
{
// Now GazeTracker is initialized
Debug.Log("onInitialized Success");
}
else
{
// GazeTracker is not initialized
Debug.Log("onInitialized Fail with reason : " + error);
}
} -
-
Define
GazeCallback.onGazedelegates, then callsetGazeCallbackfunction to register theGazeCallback.onGazedelegates.void Start()
{
GazeTracker.initGazeTracker("YOUR_DEVELOPMENT_LICENSE_KEY", onInitialized);
}
void onInitialized(InitializationErrorType error)
{
if (error == InitializationErrorType.ERROR_NONE)
{
// Now GazeTracker is initialized
Debug.Log("onInitialized Success");
// Set GazeCallback to GazeTrakcer
GazeTracker.setGazeCallback(onGaze);
}
else
{
// GazeTracker is not initialized
Debug.Log("onInitialized Fail with reason : " + error);
}
}
void onGaze(GazeInfo gazeInfo)
{
Debug.Log("onGaze " + gazeInfo.timestamp + "," + gazeInfo.x + "," + gazeInfo.y + "," + gazeInfo.trackingState + "," + gazeInfo.eyeMovementState + "," + gazeInfo.screenState);
} -
Implement
startTrackingto start theGazeTracker.void Start()
{
GazeTracker.initGazeTracker("YOUR_DEVELOPMENT_LICENSE_KEY", onInitialized);
}
void onInitialized(InitializationErrorType error)
{
if (error == InitializationErrorType.ERROR_NONE)
{
// Now GazeTracker is initialized
Debug.Log("onInitialized Success");
// Set GazeCallback to GazeTrakcer
GazeTracker.setGazeCallback(onGaze);
// Start Tracking
GazeTracker.startTracking();
}
else
{
// GazeTracker is not initialized
Debug.Log("onInitialized Fail with reason : " + error);
}
}
void onGaze(GazeInfo gazeInfo)
{
Debug.Log("onGaze " + gazeInfo.timestamp + "," + gazeInfo.x + "," + gazeInfo.y + "," + gazeInfo.trackingState + "," + gazeInfo.eyeMovementState + "," + gazeInfo.screenState);
} -
startTrackingwill be executed async. To get the correct execution result of thestartTrackingfunction, you should defineStatusCallback.onStartedandStatusCallback.onStopped, then callsetStatusCallbackto register them to theGazeTracker.void Start()
{
GazeTracker.initGazeTracker("YOUR_DEVELOPMENT_LICENSE_KEY", onInitialized);
}
void onInitialized(InitializationErrorType error)
{
if (error == InitializationErrorType.ERROR_NONE){
// Now GazeTracker is initialized
Debug.Log("onInitialized Success");
// Set StatusCallback to GazeTrakcer
GazeTracker.setStatusCallback(onStarted, onStopped);
// Set GazeCallback to GazeTrakcer
GazeTracker.setGazeCallback(onGaze);
// Start Tracking
GazeTracker.startTracking();
}
else
{
// GazeTracker is not initialized
Debug.Log("onInitialized Fail with reason : " + error);
}
}
void onStarted()
{
Debug.Log("Tracking is started");
}
void onStopped(StatusErrorType error)
{
Debug.Log("Tracking is stopped with reason : " + error);
}
void onGaze(GazeInfo gazeInfo)
{
Debug.Log("onGaze " + gazeInfo.timestamp + "," + gazeInfo.x + "," + gazeInfo.y + "," + gazeInfo.trackingState + "," + gazeInfo.eyeMovementState + "," + gazeInfo.screenState);
} -
At last, SeeSo Unity application requires camera permission. Initialize the
GazeTrackerwith theinitGazeTrackerfunction after camera permission is allowed.#if UNITY_ANDROID
using UnityEngine.Android;
#elif UNITY_IOS
using System.Runtime.InteropServices;
#endif
#if UNITY_IOS
[DllImport("__Internal")]
private static extern bool hasiOSCameraPermission();
[DllImport("__Internal")]
private static extern void requestiOSCameraPermission();
#endif
void Start()
{
#if UNITY_ANDROID
if (HasCameraPermission())
{
GazeTracker.initGazeTracker("YOUR_DEVELOPMENT_LICENSE_KEY", onInitialized);
}
else
{
RequestCameraPermission();
}
#endif
}
bool HasCameraPermission()
{
#if UNITY_ANDROID
return Permission.HasUserAuthorizedPermission(Permission.Camera);
#elif UNITY_IOS
return hasCameraPermission();
#endif
}
void RequestCameraPermission()
{
#if UNITY_ANDROID
Permission.RequestUserPermission(Permission.Camera);
#elif UNITY_IOS
requestCameraPermission();
#endif
}
void OnApplicationFocus(bool focus)
{
if (HasCameraPermission())
{
GazeTracker.initGazeTracker("YOUR_DEVELOPMENT_LICENSE_KEY", onInitialized);
}
else
{
requestPermission();
}
}
Run
Android
- Select the platform of Unity editor as Android.
Build Setting > Platform > Android > Switch platform to Android)
- Set the Android Minimum API Level as
23.
(Project Setting > Player > Other Setting > Identification > Minimum API Level 23)
- Set the Android Target API Level as
30.
(Project Setting > Player > Other Setting > Identification > Target API Level 30)
- To get the log from the SDK, activate the development build.
(Build Setting > Platform > Android > Development Build)
- Don't forget that select Scripting Backend to
IL2CPPand check target architecturesARM64.
(Project Setting > Player > Other Setting > Scripting Backend > IL2CPP)
(Project Setting > Player > Other Setting > Target Architectures > ARM64)
-
Connect the android device to PC.
-
Build & Run.
(Build Setting > Build And Run)
- After the run, the Unity editor will display the gaze tracking data logs. 🎉
iOS
- Select the platform of Unity editor as iOS.
(Build Setting > Platform > iOS > Switch platform to iOS)
- Anything must be included in the camera permission description field.
(Project Setting > Player > Other Setting > Camera Usage Description)
- Set the iOS Target SDK as
Device.
(Project Setting > Player > Other Setting > Target SDK > Device SDK)
- Set the iOS Target Minimum iOS version as
11.0.
(Project Setting > Player > Other Setting > Target Minimum OS version 11.0)
- To get the log from the SDK, activate the development build.
(Build Setting > Platform > iOS > Development Build)
- Don't forget that Check target architectures
ARM64.
(Project Setting > Player > Other Setting > Architecture > ARM64)
-
Connect the iOS device to PC.
-
Build.
(Build Setting > Build)
-
After the build, Xcode Project will be created. This project only can be used by signing in Xcode.
-
Open and
Build and then run the current schemethe xcode project. -
After the run, the Xcode editor will display the gaze tracking data logs 🎉
Preview for Android
-
The camera preview used by the Android SDK is TextureView, which only works when hardware acceleration is enabled.

-
By default, Unity does not use hardware acceleration, so it must export Android Project to modify Android Menifest.

-
Modify the hardwareAccelerated attribute of activity tag to true in AndroidManifest.xml of unityLibrary module

-
To build and run the app, press arrow button
