Unity

circle-info

Hackle Unity SDK is built on top of Android SDK and iOS SDK. The following OS versions are supported.

  • Android API 16 (4.1 Jelly Bean) and above

  • iOS 10 and above

triangle-exclamation

SDK Installation

The SDK must be installed via Unity Package Manager.

Click herearrow-up-right to download the SDK.

In Unity, click Assets > Import Package > Custom Package. Select the downloaded package and import it to complete the installation.

Android ProGuard / R8

If you are using ProGuard or R8, obfuscation rules are automatically included in the aar artifact. If that is not the case, you must include the following rules.

circle-info

Reinstall the app after SDK installation

Unity SDK includes Android and iOS SDKs. You must rebuild the app you were testing in order to complete the integration.

Notes on Updating

When updating, you must delete the following selected libraries from the previously imported libraries before re-importing.

  • hackle-android-sdk-x.x.x

  • hackle-android-unity-wrapper-x.x.x

  • hackle-sdk-common-x.x.x

  • hackle-sdk-core-x.x.x

  • ios-arm64_armv7

  • ios-arm64_i386_x86_64-simulator

Android SDK Dependency Management

On Android, the following dependency libraries are required. If the Unity SDK does not work in an Android environment, verify that the following libraries exist.

  • hackle-android-sdk-2.12.0

  • hackle-android-unity-wrapper-1.5.0

  • hackle-sdk-common-2.9.0

  • hackle-sdk-core-2.9.0

  • core-common

  • gson

  • kotlin-stdlib

  • lifecycle-common

  • lifecycle-extensions

  • lifecycle-process

  • lifecycle-runtime

  • okhttp

  • okio

SDK Initialization

You must initialize Hackle before using the SDK. An SDK Key is required to initialize Hackle.

  • Hackle is a class that provides methods for using the SDK features.

  • Pass the SDK Key to the Initialize() method to initialize, and use await to wait until initialization is complete.

  • You can find the SDK Key in SDK Integration Infoarrow-up-right on the Hackle Service Dashboard.

SDK Initialization Config

You can initialize the SDK with configuration options included.

All Configuration Options

Config
Description
Default
Supported Version

ExposureEventDedupIntervalMillis*

Removes duplicate exposure events for the same A/B Test or Feature Flag distribution result triggered consecutively by the same user.

60000 (1 minute)

1.7.0+

Debug

Outputs logs for all features to the console and sends events immediately.

false

1.7.0+

PollingIntervalMillis

Periodically updates settings configured in the Dashboard. Min value: 60000 (60 seconds)

-1 (no periodic update)

1.7.0+

* Supported across app restarts from version 1.9.0 onward.

Get Instance

After initialization, you can get the Hackle instance using the following code.

Last updated