| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
See full documentation on the thirdweb portal.
Try out our multichain game that leverages In-App and Smart Wallets to create seamless experiences, built in 3 weeks - Web3 Warriors.
Build games for WebGL, Desktop and Mobile using 1000+ supported chains, with various login options!
| Wallet Provider | WebGL | Desktop | Mobile |
|---|---|---|---|
| In-App Wallet (Email, Social, Phone) | ✔️ | ✔️ | ✔️ |
| Local Wallet (Guest Mode) | ✔️ | ✔️ | ✔️ |
| Wallet Connect | ✔️ | ✔️ | ✔️ |
| MetaMask | ✔️ | ✔️ | ✔️ |
| Rabby | ✔️ | — | — |
| Coinbase (Including Smart Wallet) | ✔️ | ❌ | ❌ |
| Smart Wallet (ERC4337) | ✔️ | ✔️ | ✔️ |
| Injected | ✔️ | — | — |
| HyperPlay | — | ✔️ | — |
✔️ Supported ❌ Not Supported — Not Applicable
Head over to the releases page and download the latest .unitypackage file.
Follow our Getting Started Guide.
All you need is a ThirdwebManager prefab in your scene to interact with the SDK from anywhere!
Various blockchain interaction examples are available in our Scene_Prefabs scene.
Payment related interaction examples are available in our Scene_Pay scene.
Notes:
In order to access the SDK, you only need to have a ThirdwebManager in your scene.
// Configure the connection
var connection = new WalletConnection(
provider: WalletProvider.InAppWallet, // The wallet provider you want to connect to (Required)
chainId: 5, // The chain you want to connect to (Required)
email: "email@email.com" // The email you want to authenticate with (Required for this provider)
);
// Connect the wallet
string address = await ThirdwebManager.Instance.SDK.Wallet.Connect(connection);
// Interact with the wallet
CurrencyValue balance = await ThirdwebManager.Instance.SDK.Wallet.GetBalance();
var signature = await ThirdwebManager.Instance.SDK.Wallet.Sign("message to sign");
// Get an instance of a deployed contract (no ABI required!)
var contract = ThirdwebManager.Instance.SDK.GetContract("0x...");
// Fetch data from any ERC20/721/1155 or Marketplace contract
CurrencyValue currencyValue = await contract.ERC20.TotalSupply();
NFT erc721NFT = await contract.ERC721.Get(tokenId);
List<NFT> erc1155NFTs = await contract.ERC1155.GetAll();
List<Listing> listings = await contract.Marketplace.DirectListings.GetAllListings();
// Execute transactions from the connected wallet
await contract.ERC20.Mint("1.2");
await contract.ERC721.Signature.Mint(signedPayload);
await contract.ERC1155.Claim(tokenId, quantity);
await contract.Marketplace.DirectListings.BuyListing(listingId, quantity);
// Custom interactions
var res = await contract.Read<string>("myReadFunction", arg1, arg2, ...);
var txRes = await contract.Write("myWriteFunction", arg1, arg2, ...);Important: If you're uploading your build, set Compression Format to Disabled in Player Settings > Publishing Settings.
Please note that In-App Wallets (OAuth) and Coinbase (Smart Wallet) will not work with default Build and Run when testing locally.
You must host the build or run it locally yourself after adding the Cross-Origin-Opener-Policy header and setting it to same-origin-allow-popups.
Here's a simple way to do so, assuming you are in your WebGL build output folder:
// server.js
const express = require('express');
const app = express();
const port = 8000;
app.use(function(req, res, next) {
res.header('Cross-Origin-Opener-Policy', 'same-origin-allow-popups');
next();
});
app.use(express.static('.'));
app.listen(port, () => console.log(`Server running on http://localhost:${port}`));
// run it with `node server.js`Once again, please note that no action is needed for hosted builds.
If you don't want to use Minimal Stripping, you could instead create a link.xml file under your Assets folder and include assemblies that must be preserved, for instance:
<linker>
<!--Thirdweb-->
<assembly fullname="Amazon.Extensions.CognitoAuthentication" preserve="all" />
<assembly fullname="AWSSDK.CognitoIdentity" preserve="all" />
<assembly fullname="AWSSDK.CognitoIdentityProvider" preserve="all" />
<assembly fullname="AWSSDK.Core" preserve="all" />
<assembly fullname="AWSSDK.Lambda" preserve="all" />
<assembly fullname="AWSSDK.SecurityToken" preserve="all" />
<assembly fullname="embedded-wallet" preserve="all" />
<!--Other-->
<assembly fullname="System.Runtime.Serialization" preserve="all" />
<assembly fullname="Newtonsoft.Json" preserve="all" />
<assembly fullname="System" preserve="all">
<type fullname="System.ComponentModel.TypeConverter" preserve="all" />
<type fullname="System.ComponentModel.ArrayConverter" preserve="all" />
<type fullname="System.ComponentModel.BaseNumberConverter" preserve="all" />
<type fullname="System.ComponentModel.BooleanConverter" preserve="all" />
<type fullname="System.ComponentModel.ByteConverter" preserve="all" />
<type fullname="System.ComponentModel.CharConverter" preserve="all" />
<type fullname="System.ComponentModel.CollectionConverter" preserve="all" />
<type fullname="System.ComponentModel.ComponentConverter" preserve="all" />
<type fullname="System.ComponentModel.CultureInfoConverter" preserve="all" />
<type fullname="System.ComponentModel.DateTimeConverter" preserve="all" />
<type fullname="System.ComponentModel.DecimalConverter" preserve="all" />
<type fullname="System.ComponentModel.DoubleConverter" preserve="all" />
<type fullname="System.ComponentModel.EnumConverter" preserve="all" />
<type fullname="System.ComponentModel.ExpandableObjectConverter" preserve="all" />
<type fullname="System.ComponentModel.Int16Converter" preserve="all" />
<type fullname="System.ComponentModel.Int32Converter" preserve="all" />
<type fullname="System.ComponentModel.Int64Converter" preserve="all" />
<type fullname="System.ComponentModel.NullableConverter" preserve="all" />
<type fullname="System.ComponentModel.SByteConverter" preserve="all" />
<type fullname="System.ComponentModel.SingleConverter" preserve="all" />
<type fullname="System.ComponentModel.StringConverter" preserve="all" />
<type fullname="System.ComponentModel.TimeSpanConverter" preserve="all" />
<type fullname="System.ComponentModel.UInt16Converter" preserve="all" />
<type fullname="System.ComponentModel.UInt32Converter" preserve="all" />
<type fullname="System.ComponentModel.UInt64Converter" preserve="all" />
</assembly>
<assembly fullname="Nethereum.ABI" preserve="all" />
<assembly fullname="Nethereum.Accounts" preserve="all" />
<assembly fullname="Nethereum.BlockchainProcessing" preserve="all" />
<assembly fullname="Nethereum.Contracts" preserve="all" />
<assembly fullname="Nethereum.HdWallet" preserve="all" />
<assembly fullname="Nethereum.Hex" preserve="all" />
<assembly fullname="Nethereum.JsonRpc.Client" preserve="all" />
<assembly fullname="Nethereum.JsonRpc.RpcClient" preserve="all" />
<assembly fullname="Nethereum.Keystore" preserve="all" />
<assembly fullname="Nethereum.Merkle" preserve="all" />
<assembly fullname="Nethereum.Merkle.Patricia" preserve="all" />
<assembly fullname="Nethereum.Model" preserve="all" />
<assembly fullname="Nethereum.RLP" preserve=" all" />
<assembly fullname="Nethereum.RPC" preserve=" all" />
<assembly fullname="Nethereum.Signer" preserve=" all" />
<assembly fullname="Nethereum.Signer.EIP712" preserve=" all" />
<assembly fullname="Nethereum.Siwe" preserve=" all" />
<assembly fullname="Nethereum.Siwe.Core" preserve=" all" />
<assembly fullname="Nethereum.Util" preserve=" all" />
<assembly fullname="Nethereum.Web3" preserve=" all" />
</linker>The Examples folder contains a demo scene Scene_Prefabs using our user-friendly prefabs - they include script examples to get inspired and are entirely optional. You do not need to use any of them to recreate their functionality. We recommend creating your own UI once you are familiar with the SDK.
All Prefabs require the ThirdwebManager prefab to get the SDK Instance, drag and drop it into your scene and select the networks you want to support from the Inspector.
Connect Wallet - All-in-one drag & drop wallet supporting multiple wallet providers, network switching, balance displaying and more!
NFT Loader - Standalone drag & drop grid/scroll view of NFTs you ask it to display!
NFT - Displays an NFT by calling LoadNFT through script!
NFT nft = await contract.ERC721.Get(0);
Prefab_NFT nftPrefabScript = Instantiate(nftPrefab);
nftPrefabScript.LoadNFT(nft);Events - Fetch and manipulate Contract Events with a simple API!
Reading - Reading from a contract!
Writing - Writing to a contract!
Miscellaneous - More examples!
See full documentation on the thirdweb portal.
We warmly welcome contributions to the thirdweb Unity SDK! If you're looking to contribute, here's how you can get started.
Notes:
If you're unsure about something or need help, feel free to reach out to us on Discord.
Thank you for contributing to the thirdweb Unity SDK!
| Back | FazBrowse Home | New Git URL |