Info
Content

[Unity] 1. consentmanager SDK Integration

 

Consent Management Platform (CMP) Unity Plugin

Features

  • Supports both iOS and Android platforms.
  • Provides a bridge between Unity and native platform-specific CMP functionalities.
  • Allows you to initialize, manage user consent, and handle privacy-related data.

Getting Started

  1. Installation:
    • Download the latest release of the plugin.
    • Import the package into your Unity project using Assets > Import Package > Custom Package.
  2. Preparation:

    In order to use the Unity SDK please follow these steps.

    2.1 iOS

    For iOS you just to be sure that the CmpSdk.xcframework is added accordingly to the unity Project.

    Typically for the Unity-iPhone target the xcframework should be added as Embed frameworks.

    For the UnityFramework you have to add the xcframework as Link Binary With Libraries.

  3. Usage:

    Follow these steps to start using the plugin.

      • Initialization: To use the CMP functionality, initialize the CMPManager instance.
    
    CmpManager.Instance.Initialize(domain, codeId, appName, language);
                    
      • Consent Layer: Display the consent layer using the following:
    
    CmpManager.Instance.OpenConsentLayer();
                    
      • Check Consent: Check if the user has given consent:
    
    bool hasConsent = CmpManager.Instance.HasConsent();
                    
      • Callbacks: Set callback listeners for various events:
    
    CmpManager.Instance.SetIOSCallbacks(openListener, closeListener, cmpNotOpenedCallback, onErrorCallback, onCmpButtonClickedCallback);
                    
      • Purpose and Vendor Checks: Check for consent related to specific purposes and vendors:
    
    bool hasPurpose = CmpManager.Instance.HasPurpose(id);
    bool hasVendor = CmpManager.Instance.HasVendor(id);
                    
      • Export Data: Export CMP data:
    
    string cmpString = CmpManager.Instance.ExportCmpString();
                    
  4. Documentation: For detailed API documentation and usage examples, refer to the official documentation.

Compatibility

  • Unity 20XX.X.X or later
  • iOS (via DllImport)
  • Android (via JNI)

Support

For bug reports, feature requests, or general inquiries, please open an issue on the repository.

License

This plugin is licensed under the MIT License.

Credits

Created and maintained by Skander Ben Abdelmalak.

Back to top