Unity Setup

Prerequisites

You’ll need the following before you can begin:

  • Unity 2019.2.5f1 (make sure to include iOS build support during installation).
  • Xcode 10.3+ (if building for iOS)
  • Android 7.0 (API >= 24) (if building for Android)

Note

For Android, the SDK works with ARCore. Please check this list for supported devices with ARCore.

Create a new project and import the SDK

  1. Open Unity and create a new 3D project.
  2. Select Window > Package Manager and install the following packages:
    • AR Foundation
    • ARKit XR Plugin (for iOS)
    • ARCore XR Plugin (for Android)

Install the Unity SDK

In your Unity Project > Packages > manifest.json, add the ai.fritz.vision package under dependencies:

{
    "dependencies": {
        "ai.fritz.vision": "https://github.com/fritzlabs/fritz-unity-sdk.git",
    }
}

If everything is set up correctly, you should see Fritz Vision installed in the Unity Package Manager and under the Packages folder.

Note

For keeping up-to-date with latest releases, you can check out the SDK release page.

To pin a version of the SDK to use (for example 1.0.0), you can specify a release tag:

{
    "dependencies": {
        "ai.fritz.vision": "https://github.com/fritzlabs/fritz-unity-sdk.git#1.0.0",
    }
}

iOS

To modify your Project Settings for iOS, go to File > Build Settings and open the Build Settings window. Select iOS and click Switch Platform. After the process finishes, click on Player Settings.

  1. In the Project Settings window, click Player.

  2. Click on Other Settings to expand settings for the iOS player.

  3. Configure the following settings:

    Unity iOS Player Settings
    Setting Value
    Architecture ARM64
    Bundle Identifier <Your Bundle ID>
    Camera Usage Description For AR processing
    Player Project Settings
  4. In Project Settings, click Fritz.

    Fritz Project Settings
  5. If you have not done so, Sign up for a free account then create an app on Fritz that matches the Bundle ID defined in unity.

  6. Copy the API Key from the Fritz webapp (Project Settings > <Your App> > Show API Key) into the iOS API Key input.

  7. Click download to download the necessary Fritz Frameworks.

    Note

    If you are using Xcode 10.3, set version to 4.0.1.

  8. In the Unity Build Settings window, click Build and Run.

Android

To modify your Project Settings for Android, go to Edit > Project Settings, click on the Player option and under “Other Settings”, click on the Android tab.

  1. In the Project Settings window, click Player.

  2. Click on Other Settings to expand settings for the Android player.

  3. Configure the following settings:

    Unity Android Player Settings
    Setting Value
    Graphics API OpenGLES3 (only)
    Multi-threaded Rendering Unselected
    Package Name <Your Package Name>
    Minimum API Level Android 7.0 Nougat (API level 24)
    Target Architecture ARMv7
    Player Project Settings
  4. In Project Settings, click Fritz.

    Fritz Project Settings
  5. If you have not done so, Sign up for a free account then create an app on Fritz that matches the Bundle ID defined in unity.

  6. Copy the API Key from the Fritz webapp (Project Settings > <Your App> > Show API Key) into the Android API Key input.

  7. Generate a custom build.gradle template by following these directions (“Providing a custom build.gradle template”).

    Once you have the template created under Assets > Plugins > Android > mainTemplate.gradle, make sure to include .tflite under aaptOptions > noCompress.

    aaptOptions {
        noCompress = ['.unity3d', '.tflite', ...]
    }
    

    This will tell gradle not to compress TensorFlow Lite models included with the sdk.

  8. In the Unity Build Settings window, click Build and Run.