Supported Platforms

  • ✅ MacOS / iOS
  • ✅ Android
  • ✅ WebGL
  • ❌ Windows
  • ❌ Linux

Installation

Privy’s Unity SDK is distributed as a .unitypackage file, and is not yet available in Unity’s package manager. To import the SDK:

  1. Request access from [email protected]
  2. Download the .unitypackage file
  3. Open your project in the Unity editor
  4. Select Assets → Import Package → Custom Package:
  1. Confirm the import of the custom package. A window will pop up listing all the assets included in the package; click Import to add all the assets to your project.

Privy’s Unity package includes dependencies such as Newtonsoft.Json and unity-webview. If your project already includes these packages, the Unity Editor should automatically detect them and uncheck them by default. However, if this doesn’t happen, you should manually deselect these packages during the import process to avoid potential duplicate instances, which could lead to errors.

Using the Privy Namespace

All Privy classes in Unity live in the Privy namespace. At the top of each file that uses Privy, you must add the using Privy directive:

using Privy;

WebGL Setup

Privy’s Unity SDK leverages an iframe to secure the key material for a user’s embedded wallet. Given the use of an iframe, we recommend testing builds with Privy’s Unity SDK in the browser, or on a non-WebGL platform in the Unity editor.

Watch this demo of setting up the Privy SDK in a Unity Project!

To configure settings for your WebGL build to work with Privy, go to your Project Settings in the Unity editor. Next, select Player and navigate to WebGL. Set the following values:

  • In Resolution and Presentation, select unity-webview, or unity-webview-2020 as the template if you are using a Unity editor version newer than 2020.
  • In Other Settings/Optimization, managed stripping level to minimal

The following versions of the Unity editor are not supported, due to this bug: 2022.3.20f1, 2022.3.40f1, 2023.2.12f1, 6000.0.0b11.

Was this page helpful?