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.
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 Desktop
- Windows: Before launching Unity you should check presence of the following tools in Microsoft VS2019:
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/BaseAssets/Resources/BanubaClientToken.txt
.
2. Preparation
Run Unity Hub and add the BanubaSDK Unity project which comes with SDK Archive.
In the project files tree find and open SampleScene.unity under Assets -> BanubaFaceAR -> BaseAssets -> Scenes. Now you should see a sample scene active in the Unity Scene section.
To select mask enable checkbox in the Inspector for the required object. You can find masks in Hierarchy window under Effects -> FacesController -> Face0 -> FaceMesh.
Click the "Play" button in Unity to check how the SampleScene works on the desktop.
3. Launching on platforms
iOS
iOS plugin for Unity is required
- In Unity open File -> Build Settings
- Check that both LoaderScene and SampleScene checkboxes are marked with ticks and have indexes 0 and 1 respectively
- Select iOS platform in the platforms list in the left column
- Click the "Switch Platform" button
- Once the platform is switched, click "Build And Run" button in the same window
- Specify the location and the name for Unity xCode project
- The project will run automatically if build succeeded OR you can open Unity-iPhone.xcodeproj file from the folder with the generated xCode project
- Sign the project in xCode and launch the app
MacOS
- In Project window find and select
BNBRecognizer.bundle
under Assets -> Plugins -> MacOS. Then in Inspector selectAny CPU
in Platform settings -> Mac OS X -> CPU dropbox - In Unity open File -> Build Settings
- Select MacOS platform in the platforms list in the left column
- Click "Switch Platform" button
- Once the platform is switched, select
Intel 64-bit + Apple silicon
in Architecture dropbox and click "Build" button in the same window - Specify the location and the name for MacOS executable
Windows
- In Unity open File -> Build Settings
- Select Windows platform in the platforms list in the left column
- Click "Switch Platform" button
- Once the platform is switched, click "Build" button in the same window
- Specify the location and the name for Windows executable
Android
Android plugin for Unity is required
- In Unity open File -> Build Settings
- Check that both LoaderScene and SampleScene checkboxes are marked with ticks and have indexes 0 and 1 respectively
- Select Android platform in the platforms list in the left column
- Click "Switch Platform" button
- Check that device is updated or click "Refresh" button
- Once the platform is switched, click "Build And Run" button in the same window
- Specify the location and the name for Android .apk file
- The .apk will run automatically if build succeeded OR you can install the generated .apk with adb or directly from your device