Skip to main content

Unity Face AR SDK Getting Started

Unity Face AR SDK allows developers to create cross-platform face tracking apps in Unity3D with custom Snapchat-like lenses, animated effects, face filters and 3D masks.

note

If you have any issues when running the Banuba Face AR plugin, please refer to the troubleshooting section or contact our support.

Requirements#

  • Latest Unity Hub with latest installed Unity
  • Installed Unity platform plugins for each required platform: Android, iOS or Web
  • Windows: Before launching Unity you should check presence of the following tools in Microsoft VS2019:

Image

1. Banuba Face AR plugin for Unity#

Get the client token
To start working with the Face AR Business plugin for Unity, you need to have the client token. To receive the client token please fill in our form on banuba.com website, or contact us via info@banuba.com.

Before opening and building the Demo project, place your client token inside appropriate file in the following location: Assets/BanubaFaceAR/Resources/BanubaClientToken.txt.

2. Preparation#

  1. Run Unity Hub and add the BanubaSDK Unity project which comes with SDK Archive. image

  2. In the project files tree find LoaderScene and SampleScene under Assets -> Scenes. Drop first LoaderScene then SampleScene to the active scenes section and make it active. Now you should see a sample scene active in the Unity Scene section. image

  3. Add SampleScene to LoaderScene Script. image

  4. To select mask enable checkbox in the Inspector for the required object. The list of the masks can be found in Unity scene Faces list. image

  5. Click the "Play" button in Unity to check how the demo scene works on the PC. image

3. Launching on platforms#

iOS#

note

iOS plugin for Unity is required

  1. In Unity open File -> Build Settings
  2. Check that both LoaderScene and SampleScene checkboxes are marked with ticks
  3. Select iOS platform in the platforms list in the left column
  4. Click the "Switch Platform" button image
  5. Once the platform is switched, click "Build And Run" button in the same window
  6. Specify the location and the name for Unity xCode project
  7. The project will run automatically if build succeeded OR you can open Unity-iPhone.xcodeproj file from the folder with the generated xCode project
  8. Sign the project in xCode and launch the app

MacOS, Windows#

  1. In Unity open File -> Build Settings
  2. Select MacOS platform in the platforms list in the left column
  3. Click "Switch Platform" button
  4. Once the platform is switched, click "Build" button in the same window
  5. Specify the location and the name for MacOS executable

Android#

note

Android plugin for Unity is required

  1. In Unity open File -> Build Settings
  2. Check that both LoaderScene and SampleScene checkboxes are marked with ticks
  3. Select Android platform in the platforms list in the left column
  4. Click "Switch Platform" button image
  5. Check that device is updated or click "Refresh" button
  6. Once the platform is switched, click "Build And Run" button in the same window
  7. Specify the location and the name for Android .apk file
  8. The .apk will run automatically if build succeeded OR you can install the generated .apk with adb or directly from your device
Last updated on