Skip to main content

Installing PnP Unity SDK

Download the Unity Package

Download .unitypackage from our latest release and import the package file into your existing Unity3D project.

warning

You may encounter errors when importing this package into your existing project.

The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

To fix this problem you need to add the following line into the dependencies object which is inside the Packages/manifest.json file.

/Packages/manifest.json
"com.unity.nuget.newtonsoft-json": "3.2.1"
tip

We recommend you use the Nethereum Library for making the blockchain calls. You can check our documentation on how to integrate Nethereum it with Web3Auth here.

Configuration

Configure a Plug n Play project

  • Go to Developer Dashboard, create or select an Web3Auth project:

  • Add {{SCHEMA}}://{YOUR_APP_PACKAGE_NAME}/auth to Whitelist URLs.

  • Copy the Client ID for usage later.

Unity SDK works on Unity deep linking features to redirect the callback from Web3Auth. Before building the application for Android/IOS you need to register the redirect_uri, which can be easily done using the tool provided inside the SDK. To achieve that, you need to follow the steps mentioned below.

  • Open the "Deep Link Generator" tool provided by Web3Auth Unity SDK from Window > Web3Auth > Deep Link Generator

    Deep Link Generator
  • Enter the redirect_url {{SCHEMA}}://{YOUR_APP_PACKAGE_NAME}/auth and click generate.

tip

We're using torusapp://com.torus.Web3AuthUnity/auth as the redirect_url in our example just to give you a reference on how your app's redirect_url should look like.

Add Web3auth Configuration Script to the scene

  • Inside Project > Assets > Plugins > Web3AuthSDK there is a file called Web3auth that must be dragged to the component in the scene. In our examples we are using a canvas. So you can now configure you clientId, rediretUrl and Network from the UI.

    Config Web3Auth

Android

  • You can create an android manifest in unity