> ## Documentation Index
> Fetch the complete documentation index at: https://docs.immutable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Unity SDK

Native C# bindings for Passport authentication, wallet operations, and blockchain data queries.

<Info>
  **Who is this for?** Game developers using Unity who want to integrate web3 features, NFTs, and blockchain functionality into their games.
</Info>

## Platform Compatibility

| Unity Version   | Windows        | macOS          | Android        | iOS            |
| --------------- | -------------- | -------------- | -------------- | -------------- |
| **Unity 6**     | ✅ Full support | ✅ Full support | ✅ Full support | ✅ Full support |
| **2021.3 LTS+** | ✅ Full support | ✅ Full support | ✅ Full support | ✅ Full support |

<Warning>
  **Unity 6 Android Users**: If using Unity 6 with Android, you must set the Application Entry Point to `Activity` (not the default `GameActivity`). See [Unity 6 Configuration](#unity-6-configuration) below.
</Warning>

## Prerequisites

* **Unity**: 2021.3 LTS or later
* **.NET Standard**: 2.1
* **UniTask**: The [UniTask](https://github.com/Cysharp/UniTask) package (v2.3.3) is a required dependency of our SDK. Follow the instructions [here](https://github.com/Cysharp/UniTask#upm-package) to install it.
* **Git LFS**: The SDK repository uses [Git Large File Storage](https://git-lfs.github.com/) to manage `.dll` files and other binary assets. Install Git LFS before cloning or Unity Package Manager may fail to download binary dependencies correctly.

## Installation

1. Install [UniTask](https://github.com/Cysharp/UniTask#upm-package) v2.3.3 or later

   The UniTask package is a dependency of our SDK.

2. Install [Git LFS](https://git-lfs.github.com/)

   <Warning>
     Git LFS must be installed **before** adding the SDK. The SDK contains `.dll` files stored in Git LFS that won't download correctly otherwise.
   </Warning>

3. Add the Immutable SDK:

<Tabs>
  <Tab title="Package Manager">
    1) Open **Window** → **Package Manager**
    2) Click **+** and select **Add package from git URL...**
    3) Enter `https://github.com/immutable/unity-immutable-sdk.git?path=/src/Packages/Passport` and click **Add**
  </Tab>

  <Tab title="manifest.json">
    1. Open your project's `Packages/manifest.json` file
    2. Add the following in the `dependencies` block:

    ```json theme={null}
    "com.immutable.passport": "https://github.com/immutable/unity-immutable-sdk.git?path=/src/Packages/Passport"
    ```
  </Tab>
</Tabs>

#### Install a Specific Version

To install a specific version of the SDK using either method above, append `#` followed by the version tag to the git URL:

```
https://github.com/immutable/unity-immutable-sdk.git?path=/src/Packages/Passport#v1.0.0
```

For mobile platform setup (Android, iOS), see [Platform-Specific Configuration](/docs/sdks/unity/overview#platform-specific-configuration).

### Unity 6 Configuration

<Warning>
  **Unity 6 Android Required**: If using Unity 6 with Android, you must configure the Application Entry Point.
</Warning>

1. Go to **Project Settings** → **Player** → **Android** → **Other Settings** → **Configuration**
2. Set **Application Entry Point** to `Activity` (not `GameActivity`)
3. Open `AndroidManifest.xml` and remove the `UnityPlayerGameActivity` activity block; keep only the `UnityPlayerActivity` block

## Platform-Specific Configuration

<Tabs>
  <Tab title="Windows">
    ### Platform Requirements

    * **Windows**: 10 or later

    ### Scripting Backend Support

    | Backend    | Support                    | Notes                                                                                  |
    | ---------- | -------------------------- | -------------------------------------------------------------------------------------- |
    | **Mono**   | ✅ Fully supported          | Uses default Unity Web Browser (UWB)                                                   |
    | **IL2CPP** | ⚠️ Requires custom WebView | See [Advanced Configuration](/docs/sdks/unity/advanced-configuration) for Vuplex setup |

    ### Default WebView Setup

    The SDK uses [Unity Web Browser (UWB)](https://github.com/Voltstro-Studios/UnityWebBrowser) by default on Windows. UWB is not bundled with the SDK, so you must install it.

    1. Add the VoltUPR registry and required scopes, then install UWB via the Package Manager. See the [UWB GitHub repo](https://github.com/Voltstro-Studios/UnityWebBrowser) and [VoltUPR setup guide](https://upr.voltstro.dev/-/web/about).
    2. Import these packages:
       * `dev.voltstro.unitywebbrowser`
       * `dev.voltstro.unitywebbrowser.engine.cef`
       * `dev.voltstro.unitywebbrowser.engine.cef.win.x64`
    3. Confirm **UWB\_WEBVIEW** is present in your project after the packages are installed.

    <Info>
      For IL2CPP builds, use a custom WebView like Vuplex. See [Advanced Configuration](/docs/sdks/unity/advanced-configuration).
    </Info>
  </Tab>

  <Tab title="macOS">
    ### Platform Requirements

    * **macOS**: 12.5 or later

    No additional configuration required for macOS.
  </Tab>

  <Tab title="Android">
    ### Platform Requirements

    * **Minimum Android Version**: 10 or later (API Level 24+)
    * **Target API**: 33 or higher recommended

    ### Enable custom manifest and Gradle

    1. Go to **Edit** → **Project Settings** → **Player** → **Android**
    2. Expand **Publishing Settings**
    3. In **Build**, enable **Custom Main Manifest** and **Custom Main Gradle Template**

    Unity generates `Assets/Plugins/Android/AndroidManifest.xml` and `Assets/Plugins/Android/mainTemplate.gradle`. Edit these files (or your existing custom ones) as below.

    ### AndroidManifest.xml

    Add this activity inside the `<application>` element. Set `android:scheme` and `android:host` to match the redirect URIs you use in Passport (e.g. `mygame` and `callback` for `mygame://callback`):

    ```xml theme={null}
    <activity
      android:name="com.immutable.unity.RedirectActivity"
      android:exported="true" >
      <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="mygame" android:host="callback" />
        <data android:scheme="mygame" android:host="logout" />
      </intent-filter>
    </activity>
    ```

    ### mainTemplate.gradle

    Add the Chrome Custom Tabs dependency inside the `dependencies` block:

    ```gradle theme={null}
    implementation('androidx.browser:browser:1.5.0')
    ```

    <Info>
      For `androidx.browser:browser:1.5.0`, **Target API Level** must be at least 33. Set it under **Edit** → **Project Settings** → **Player** → **Android** → **Other Settings** → **Target API Level**.
    </Info>

    ### Manual Manifest Configuration (Advanced)

    If automatic merging doesn't work for your project, you can manually configure `AndroidManifest.xml`:

    ```xml theme={null}
    <activity android:name="com.unity3d.player.UnityPlayerActivity"
              android:exported="true">
      <!-- ... existing intent filters ... -->

      <!-- Add deep link intent filter -->
      <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:host="callback" android:scheme="mygame" />
        <data android:host="logout" android:scheme="mygame" />
      </intent-filter>
    </activity>
    ```
  </Tab>

  <Tab title="iOS">
    ### Platform Requirements

    * **iOS Version**: 15.2 or later

    ### URL Scheme Configuration

    Add your custom URL scheme to `Info.plist`:

    ```xml theme={null}
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>mygame</string>
            </array>
        </dict>
    </array>
    ```

    Or configure in Unity:

    1. Go to **Edit** → **Project Settings** → **Player** → **iOS** → **Other Settings** → **Supported URL schemes**
    2. Increase **Size** by 1
    3. Enter your URL scheme in the new **Element** slot (e.g. `mygame` for `mygame://callback`)
  </Tab>
</Tabs>

The SDK handles deep links automatically. Ensure your redirect URIs match your configured URL scheme.

<Info>
  Your redirect URIs (like `mygame://callback`) must use the same URL scheme that you configure in your platform settings:

  * **iOS**: Only the scheme needs to match (e.g., `mygame` in `mygame://callback`)
  * **Android**: Both the scheme AND host must match (e.g., `mygame` and `callback` in `mygame://callback`)

  See [Initialize Passport](/docs/products/passport/authentication#initialize-passport) for authentication setup.
</Info>

```csharp theme={null}
// Must match your URL scheme
passport = await Passport.Init
(
    clientId: "YOUR_CLIENT_ID",
    environment: Environment.Sandbox,
    redirectUri: "mygame://callback",      // ← mygame matches URL scheme config
    logoutRedirectUri: "mygame://logout"
);
```

## Next Steps

### Getting Started

<CardGroup cols={2}>
  <Card title="Configure Your Project" icon="gear" href="https://hub.immutable.com">
    Set up credentials and OAuth client in Immutable Hub
  </Card>

  <Card title="Authentication" icon="key" href="/docs/products/passport/authentication">
    Initialize Passport and implement login
  </Card>

  <Card title="Wallet Operations" icon="wallet" href="/docs/products/passport/wallet">
    Access wallet addresses and balances
  </Card>

  <Card title="Game Bridge Architecture" icon="sitemap" href="/docs/sdks/game-bridge-architecture">
    Understand SDK internals and custom engine integration
  </Card>
</CardGroup>

### Additional Resources

<CardGroup cols={2}>
  <Card title="Advanced Configuration" icon="gear" href="/docs/sdks/unity/advanced-configuration">
    Custom WebView, IL2CPP support
  </Card>

  <Card title="FAQ" icon="circle-question" href="/docs/sdks/unity/faq">
    Common questions and troubleshooting
  </Card>

  <Card title="GitHub" icon="github" href="https://github.com/immutable/unity-immutable-sdk">
    SDK source code and samples
  </Card>
</CardGroup>
