Initializing the SDK - optimove-tech/Optimove-SDK-Unity GitHub Wiki

Repository structure

This repository contains 3 folders:

  1. Artifacts has everything necessary to integrate with Optimove Unity SDK. This includes Optimove.unitypackage and OptimoveNativeAssets~ required if integrating with iOS.
  2. unity-sdk contains a Unity project used to create Optimove.unitypackage.
  3. ExampleApp is an example project with imported Optimove.unitypackage. Check ExampleApp/README.md if you want to run it.

Initialization

Depending on which features were enabled for your app you will be able to retreive the following credentials from the Settings section of Optimove UI:

  • YOUR_OPTIMOVE_CREDENTIALS – Your unique SDK token in order to identify your Optimove tenant
  • YOUR_OPTIMOVE_MOBILE_CREDENTIALS – The mobile config used to identify your app bundle

Optimove Unity SDK is distributed as a Unity package for importing into your projects. For integration:

  1. Import Optimove.unitypackage into your Unity project
  2. Importing the package will add OptimoveInit.cs script to the Assets folder. Add it to MainCamera.
  3. Create Assets/OptimoveConfigFiles/optimove.json file with the following:
{
  "optimoveCredentials": "YOUR_OPTIMOVE_CREDENTIALS",
  "optimobileCredentials": "YOUR_OPTIMOVE_MOBILE_CREDENTIALS",
}

Android

In Player Settings verify (it should be set automatically):

  • Custom gradle main template set to Plugins/Android/mainTemplate.gradle,
  • Custom gradle launcher template set to Plugins/Android/launcherTemplate.gradle
  • Custom gradle base template set to Plugins/Android/baseProjectTemplate.gradle
  • Custom main manifest set to Plugins/Android/AndroidManifest.xml.
  • For 2020.3+ make sure custom gradle properties template set to Plugins/Android/gradleTemplate.properties

iOS

  1. Move Artifacts/OptimoveNativeAssets~ from Artifacts folder to Assets/ folder. The xcframeworks will be automatically added when the project is built.
  2. Build project. Verify New Build System in Xcode is enabled.

Usage

In your Unity code, you can now import & use Optimove features:

using OptimoveSdk;