[Unity] 1. consentmanager SDK Integration

1. Overview

consentmanager SDK is a comprehensive solution for managing user consent in mobile applications. Designed to handle GDPR compliance, user privacy preferences, and ad tracking transparency, this SDK provides a seamless integration for iOS and Android platforms. Additionally, it offers wrapper plugins/bridges for React Native, Flutter, and Unity, making it versatile across various development environments.

This document covers the installation procedure and features made available to clients developing apps with Unity to access our consent management CMP SDK via the Unity C# Native Bridge. For further details about the underlying native SDKs, please refer to our iOS and Android API Documentation pages.

The Unity package contains a Demo Scene (ConsentManagerDemo) with a simple implementation that showcases the most common use cases of the consent management procedures inside a Unity mobile app.

2. Installation

2.1 Steps — High-level description

  1. Integration and configuration: Integrate the SDK into your mobile app, then configure the SDK settings according to your needs.
  2. Create an instance and display the consent layer: On app startup, create an instance of the CMPManager class. This instance handles the consent process. The SDK automatically displays the consent screen if needed.
  3. Process user consent data: Once consents are collected, the information is stored and available for querying through different properties and methods exposed by the SDK. You’ll have information about rejected or accepted consents, vendors, and purposes.

2.2 Compatibility

  • Unity 20XX.X.X or later (note: there are known vulnerabilities in earlier Unity versions)
  • iOS (via DllImport)
  • Android (via JNI)

2.3 Importing the SDK package

Make sure your build.gradle file inside the Android folder of your project declares the proper dependency. This is a Unity C# Native Bridge, so both dependencies must be in sync. The same applies for iOS: make sure your podspec file reflects the proper dependency, as shown below.

  1. Download the latest release of the plugin.
  2. Import the package into your Unity project via Assets › Import Package › Custom Package.
  3. You’ll see the ConsentManagerSDK folder inside the Assets folder in the project structure on the Unity Editor.
  4. Switch to your chosen platform, build the solution, and open the generated project in the respective IDE of your choice.

2.4 Platform-specific setup

iOS

  • Set the XCFramework as a dependency, using either CocoaPods or SPM.
  • Add cm-sdk-ios-v3 to the Unity-iPhone and UnityFramework targets in the Frameworks and Libraries section of Xcode.

Android

  • Set the Android SDK as a dependency in the build.gradle file at the :unityLibrary module level:
implementation 'net.consentmanager.sdkv3:cmsdkv3:3.6.0'

We do our best to keep this purely informative documentation up to date. However, if you notice that any of these guides need a little touch-up, let us know!