SDK Developer Guide Release 2.3.x

Using the SDK

The purpose of the SDK is to detect facial expressions and their underlying emotions, and appearance from facial images. The SDK is distributed as a Unity package. Its included files enable integration with Unity games and applications. These two data folders are required by Unity:

  • Affdex: C# code and required libraries.
  • StreamingAssets: The classifier data files required by the libraries.

Watch the video tutorial below to help you get started on how to use the SDK:

Getting started

We package our plugin as an asset, like those you can buy on Unity’s Asset Store. You can download it from below.

OSX i386/x86_64, Windows x86/x86_64, Android ARM7/x86, iOS ARM64/ARM7 2.3 (release notes) 207 MB Download

The purpose of the asset is to detect facial expressions and their underlying emotions from facial images. Facial images can be captured from different sources:

  • Camera: images from the webcam (or front camera for mobile devices)
  • Frames: a sequence of timed images.
  • Video: a video file on a device’s local storage.

The SDK’s Detector class implements the core detection functionality, and can be used in any of these three scenarios, although the steps are a bit different in each case.


There are several example Unity apps available on GitHub which you can examine to see the SDK in action:

Class Documentation

The classes that come with this asset are viewable here.

Requirements & Dependencies

Hardware requirements (recommended)

  • Processor, 2 GHz (64-bit)
  • RAM, 1 GB
  • Disk Space (min) : 950 MB

Runtime Requirements

Supported operating systems

  • Windows 7 and above
  • Mac OS X 10.9.5 and above
  • Android 4.3 and above
  • iOS 8.0 and above

Special Notes

This section outlines issues you may encounter depending on how you use the plugin.


  • If you build for multiple platforms and want to no-op unsupported platforms you can run AffdexUnityUtils.ValidPlatform() to determine if the current platform is valid at run-time.
  • OS X builds only work as universal and x86_64 binaries.
  • Building Android apps in Unity requires installation of the Android SDK.

Apple App Store Submission

The Apple app store has a rigorous set of automated tests it runs on submissions to validate that applications meet their guidelines. They will specifically expect certain parts of your game to be signed using a certification authority. All files that need to be signed must be signed using the same signature authority. This means that you as an individual, or your company, will need a signing certificate for not only your files, but for the files that come from Affectiva. If the Affectiva files are signed by Affectiva and your other game files are signed by you, your submission will be rejected by the app store.

The order in which files and bundles are signed is also critical. You must sign the inner-most files first. Here is a Stack Overflow answer that includes a shell script that signs in the proper order.