Skip to content

Configuration

This page walks through adding the Affise Unity package to your project, performing any native platform configuration, and initializing the SDK.

From the README verbatim:

Open Package Manager (Window / Package Manager)

Add package from git url https://github.com/affise/affise-mmp-sdk-unity.git

Alternate install via a downloaded .unitypackage:

Download latest Affise SDK attribution-1.7.7.unitypackage from the releases page and drop this file into the Unity editor.

The package manifest identifier is com.affise.attribution at version 1.7.7 (package.json:2-3).

After import the SDK expects either:

  1. An Affise Settings.asset created via Edit / Project Settings / AffiseCreate button, placed under Assets/Affise/Resources/, or
  2. A manual Affise.Settings(...).Start() initialization in code.

The Unity package ships post-build processors that wire up the native Android and iOS plugins.

The bundled Android library lives at Runtime/Plugins/unity.androidlib/ (Runtime/Plugins/unity.androidlib/build.gradle:1). Its manifest at Runtime/Plugins/unity.androidlib/src/main/AndroidManifest.xml:1-3 declares package com.affise.attribution.unity and no permissions.

Gradle configuration for the Android library:

apply plugin: 'com.android.library'
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
targetSdkVersion 30
}
}
final affise_version = "1.7.7"
dependencies {
implementation "com.android.installreferrer:installreferrer:2.2"
// Affise SDK
implementation "com.affise:internal:$affise_version"
}

Build hooks:

  • Android post-processor: Editor/Build/Modules/ModulesAndroidPostProcessBuild.cs:10 (implements IPostGenerateGradleAndroidProject).
  • Android deeplink preprocessor: Editor/Build/Deeplink/DeeplinkAndroidBuild.cs:16 (implements IPreprocessBuildWithReport).

Initialize by calling Affise.Settings(affiseAppId, secretKey).Start() (Runtime/Affise.cs:41, Runtime/Settings/AffiseSettings.cs:172):

Affise
.Settings(
affiseAppId: "Your appId", //Change to your app id
secretKey: "Your SDK secretKey" //Change to your SDK secretKey
)
.Start(); // Start Affise SDK