![](https://images.ctfassets.net/wk2k9fpkzm7n/v3OS4OHxE1IYijuQqFNq6/326446671afdd16203b9152cabaa4508/1_9-gFQsQUG-8aPDlIjGPLEg.webp?q=100&w=1400)
Have you built a game and want to add web3 elements, such as NFTs or ERC20 token transfers?
The Sequence Unity SDK is here to help :) With a wallet that can embed directly into your game, an SDK for indexing real-time data from the blockchain, and many other useful web3 functions, Sequence makes it easy to bring your game to web3. Sequence was built by Horizon during the development of Skyweaver, so it’s specifically built to enable seamless web3 gaming experiences.
This tutorial goes over how to implement the Sequence Wallet into your Unity game. The wallet allows users to sign transactions like transferring NFTs and tokens. Check out the demo dapp to see everything the wallet can do.
Install the Sequence Unity SDK
Before continuing, your game will need to use the Vuplex Webview package, so please ensure you have installed this.
Download the Sequence Unity SDK UnityPackage here. Then, drag the .unitypackage file into your Unity project and import everything.
Set up the Sequence Wallet
Note: This was published on February 8th, 2023. Since we’re constantly upgrading the Unity SDK, there’s a chance the code is out-of-date or there are additional options and features not included here. Always be sure to check out the Sequence Docs for the most up-to-date code.
To start, you’ll need to include the Sequence Wallet prefab
SequenceSDK/SequenceSharp/Prefabs/SequenceWalletPrefab.prefab.
![](https://images.ctfassets.net/wk2k9fpkzm7n/1PrXuHP9vJYbXD2txsRzUl/40ba03a36f4117053863d1e04e4e4d3e/0_nJzeAtZA0xzy__zh.png?q=100&w=818)
Put the prefab in your scene inside a Canvas.
![](https://images.ctfassets.net/wk2k9fpkzm7n/uYCpT7TwKRUUSIP9HUr73/f8de4c5b1ef4fc98db0629fa631f2a3c/0_dTDoqv3LcRlG73Bo.png?q=100&w=688)
Position and scale it how you want. This will be the viewport where the wallet is rendered in non-WebGL builds.
You can edit the properties in the inspector to hook up events, set the default network, and enable some debugging tools.
![](https://images.ctfassets.net/wk2k9fpkzm7n/2P9idtLr7CWkt8jJHwfY8v/e761b570856294bcb0dcb0cd7be47887/0_thnx2AsJBHq9h6F4.png?q=100&w=904)
Before calling any Wallet methods, you should hook up the onWalletOpened and onWalletClosed events. Sequence will automatically make itself visible and invisible. Still, you might have extra chrome / animations you’d like to add to the wallet and/or auth window (for example a close wallet button).
A simple solution is adding a Canvas Group and moving the SequenceWalletPrefab prefab inside it, and toggling visibility when the wallet opens/closes. These callbacks might not occur on the main thread in some builds (e.g. Android), so make sure you use a UnityMainThread job to do your visibility toggling on the main thread.
wallet.onWalletOpened.AddListener(() => {UnityMainThread.wkr.AddJob(() => {walletContainer.alpha = 1f;walletContainer.interactable = true;walletContainer.blocksRaycasts = true;});});wallet.onWalletClosed.AddListener(() => {UnityMainThread.wkr.AddJob(() => {walletContainer.alpha = 0f;walletContainer.interactable = false;walletContainer.blocksRaycasts = false;});});
All the Sequence Wallet functions & classes are namespaced in the SequenceSharp namespace, so you might want to add using SequenceSharp; at the top of your CS files.
Before interacting with the SDK, you should make sure it’s ready:
if (wallet.readyToConnect) {// your Connect function call here} else {wallet.onReadyToConnect.AddListener(()=> {// your Connect function call here});}
Connect the wallet
Once the wallet has been set up, you can connect to it by calling wallet.Connect.
var connectDetails = await wallet.Connect(new ConnectOptions {app = “My Unity Dapp”,authorize = true,}});Debug.Log(“user accepted connect? “ + connectDetails.connected)Debug.Log(“users signed connect proof to valid their account address: “, connectDetails.proof)
Open the wallet
After you connect, you can use `wallet.openWallet()` to open the wallet:
await wallet.OpenWallet();
Using this code will open Sequence Wallet with its default options. The wallet is highly customizable, with options such as a banner with an image from your game, dark mode, and your preferred sign-in options. Check out the list of settings and how to define them here.
Once you have connected the wallet, you can do any operations that Netherum supports, using our Nethereum integration, or anything that can be done with the Javascript Sequence SDK using the escape hatch. This includes, but is not limited to, transaction relaying, batching transactions, exploring the chain, and more. We are constantly adding to Sequence to pack features for developers onboarding users onto web3.
Sequence is the leading all-in-one development platform for integrating web3 into games. Onboard, monetize, grow, and retain players with Sequence’s award-winning technology. From collectibles and ownable rewards to fully on-chain experiences, Sequence’s easy-to-integrate platform solves blockchain complexities, so developers can focus on creative execution and delivering amazing player experiences. Trusted by hundreds of games, thousands of developers, and powering millions of users, Sequence is backed by Take-Two Interactive, Ubisoft, Xsolla, Bitkraft, Brevan Howard, Coinbase, Polygon, and more. To learn more, please visit: https://sequence.xyz/
---
Have any suggestions on how to improve Sequence development platform? Request a new feature here!
Written by
![](https://images.ctfassets.net/wk2k9fpkzm7n/ynbaIWMWyrMQxwGtPX0xq/2f433f8b3b5cbd637a0f98875d4ebb5c/Rob.jpg?q=100&w=200)
Robert Guenette
Product Marketing DirectorRelated posts