Create a game in Unity
To make these instructions concrete, we have created a sample ecosystem wallet called Rapidfire ID. To interact with it, you can find its SDK in the NPM package directory: @rapidfire/id.
You can check out the GitHub repository for Rapidfire Wallet to learn how to create your own wallet.
This guide will walk you through adding support for any ecosystem wallet into a Unity app by integrating the Mobile Wallet Protocol.
We have added compilation flags to the Unity SDK to ensure that specific Unity editors can only build certain platform targets. Please note that the table below indicates which editor you can use to build a platform target, but it does not determine whether you can run the SDK in that editor.
For example, the SDK allows you to build iOS games using a macOS Unity Editor, but you cannot use the Windows Unity Editor.
Target Platform | Windows Unity Editor | macOS Unity Editor |
---|---|---|
Windows | ✅ | ❌ |
macOS | ❌ | ✅ |
Android | ✅ | ✅ |
iOS | ❌ | ✅ |
Web | Coming soon | Coming soon |
If you need a template or scaffold to start with, you can check out the Ecosystem Wallet Unity Example.
Setup#
Install Mobile Wallet Protocol Client#
There are two ways to install the SDK:
- Open the Package Manager
- Click the add + button and select "Add package from git URL..." Enter https://github.com/openfort-xyz/mobile-wallet-protocol-unity-client?path=com.openfort.mobile-wallet-protocol and click 'Add'
Usage#
Mobile Wallet Protocol Client provides 2 interfaces for mobile app to interact with the Smart Wallet, an EIP-1193 compliant provider interface.
Option 1: EIP-1193 Provider#
Create a new EIP1193Provider
instance, which is EIP-1193 compliant.
Gas Sponsorship#
If you want to sponsor transactions, you need to add #policy=POLICY_ID
to the wallet scheme.
_10#policy=POLICY_ID