Initializing the SDK - optimove-tech/Optimove-SDK-Unity GitHub Wiki
Repository structure
This repository contains 3 folders:
Artifacts
has everything necessary to integrate with Optimove Unity SDK. This includesOptimove.unitypackage
andOptimoveNativeAssets~
required if integrating with iOS.unity-sdk
contains a Unity project used to createOptimove.unitypackage
.ExampleApp
is an example project with importedOptimove.unitypackage
. CheckExampleApp/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:
- Import
Optimove.unitypackage
into your Unity project - Importing the package will add
OptimoveInit.cs
script to theAssets
folder. Add it toMainCamera
. - 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
- Move
Artifacts/OptimoveNativeAssets~
fromArtifacts
folder toAssets/
folder. The xcframeworks will be automatically added when the project is built. - Build project. Verify New Build System in Xcode is enabled.
Usage
In your Unity code, you can now import & use Optimove features:
using OptimoveSdk;