This Unity Project demonstrates key features of the "Tezos SDK For Unity". It contains one isolated Unity Scene for each feature.
- Download this repo (*.zip or *.git)
- Download the Unity Editor
- Open this repo in the Unity Editor
- Enjoy!
- Web Documentation - Overview of the "Tezos SDK For Unity"
- Unity Project - ./Unity/
- Unity Version - Version
- Unity Target - Standalone MAC/PC
- Unity Menus - See
Unity → Window → Tezos → Tezos SDK For Unity → Open ReadMe
for additional orientation - Unity Dependencies - The Unity Package Manager resolves all project dependencies from the Manifest.json including the Tezos SDK For Unity. No further action is required
This Unity Project is featured in the following videos.
Tezos SDK For Unity - Authentication | Tezos SDK For Unity - NFTS |
---|---|
Example01_Authentication | Example02_NFTTokenGating |
---|---|
This project showcases several key features and use-cases for the "Tezos SDK For Unity". Here are highlights.
Authentication
User connects to the blockchain with a Tezos-compatible mobile wallet.
To see this feature in action, play the Example01_Authentication
Scene. The Example01_Authentication.cs class provides a full demonstration. Here is partial snippet.
// Store reference for convenience
ITezosAPI tezos = TezosSingleton.Instance;
// Determines if the user is authenticated
if (!tezos.HasActiveWalletAddress())
{
// Makes a call to connect with a wallet
tezos.ConnectWallet();
}
NFTs
User checks ownership of a given NFT. In production, this may unlock related game features.
To see this feature in action, play the Example02_NFTTokenGating
Scene. The Example02_NFTTokenGating.cs class provides a full demonstration. Here is partial snippet.
// Setup
string demoNFTAddress = "KT1BRADdqGk2eLmMqvyWzqVmPQ1RCBCbW5dY";
int demoTokenId = 1;
// Store reference for convenience
ITezosAPI tezos = TezosSingleton.Instance;
// Returns the address of the current active wallet
string activeWalletAddress = tezos.GetActiveWalletAddress();
// Determines if the user account owns a given Nft
bool hasTheNft = tezos.IsOwnerOfToken(
activeWalletAddress,
demoNFTAddress,
demoTokenId);
if (hasTheNft)
{
// Unlock special game features
}