Releases: thirdweb-dev/unity
v5.1.0
The Pinnacle of Account Systems Has Been Reached
This is no exaggeration, our Ecosystem Wallets are now so feature rich there is no use case in all of gaming that it does not support.
Thirdweb now provides you with a cross-platform, cross-sdk, cross-device, cross-language blockchain-powered, secure, non-custodial account system that you can not only reuse across your own games and apps, but also your ecosystem partnners' games and appsl.
It doesn't stop there, you can use this EcosystemWallet to create a Guest mode (AuthProvider.Guest
) first and upgrade later through Account Linking, which we feature here alongside other additions like Line authentication. All of this without losing the EcosystemWallet address.
The Account Linking feature, once understood, unlocks infinite possibilities as it ties into all our auth methods, which now include:
- Email (OTP)
- Phone (OTP)
- Apple
- Discord
- Farcaster
- Telegram
- Line
- Siwe (Sign in with Ethereum - yep you can link external wallets and even login to your EcosystemWallet with them next time)
- Guest (does not require any inputs, simply choose it as your auth provider to create a guest mode)
It doesn't stop there, we also offer custom authentication:
- JWT (you want to create a wallet out of an OIDC-compatible authentication system, entirely possible)
- AuthEndpoint (you want to go even further, having us verify a generic payload against your backend, for things like TG Mini-Apps)
There is not a single use case we don't support. You just have to integrate, and we're here to help.
If you don't want to commit to a performant, scalable, entirely secure and shareable with third-parties and fast EcosystemWallet, don't worry, all of the above is available for InAppWallet too.
Now for how-to's
Do note that once again, it's the same API for InAppWallet, but without ecosystemId
and the optional ecosystemPartnerId
.
Below are the different ways you can use some of the functionality introduced in this version.
You can turn any of these wallets into a Smart Wallet easily, using SmartWallet.Create
or by passing SmartWalletOptions
to Unity's ThirdwebManager.ConnectWallet
function on top of your base options / using the ThirdwebManager.UpgradeToSmartWallet
helper if you want to do it later.
Login With Guest (.NET SDK)
var guestWallet = await EcosystemWallet.Create(ecosystemId: "ecosystem.the-bonfire", client: client, authProvider: AuthProvider.Guest);
if (!await guestWallet.IsConnected())
{
_ = await guestWallet.LoginWithGuest();
}
var address = await guestWallet.GetAddress();
Login With Guest (Unity)
var walletOptions = new WalletOptions(
provider: WalletProvider.EcosystemWallet,
chainId: 421614,
ecosystemWalletOptions: new EcosystemWalletOptions(ecosystemId: "ecosystem.the-bonfire", authprovider: AuthProvider.Guest)
);
var ecosystemWallet = await ConnectWallet(walletOptions) as EcosystemWallet;
Get Linked Accounts
var linkedAccounts = await ecosystemOrInAppWallet.GetLinkedAccounts();
Link a new Account
All Auth Methods Supported! Just pass the related params to that auth method that you typically would
// Assuming you already have a connected wallet you want to link a new profile to
var walletToLink = await InAppWallet.Create(client: client, authProvider: AuthProvider.Google);
var linkedAccounts = await mainConnectedWallet.LinkAccount(walletToLink );
A Full Unity Example, ThirdwebManager is there as a helper after all and APIs are simpler
// Sign up with guest mode to avoid the friction of auth with new users
var walletOptions = new WalletOptions(
provider: WalletProvider.EcosystemWallet,
chainId: 421614,
ecosystemWalletOptions: new EcosystemWalletOptions(ecosystemId: "ecosystem.the-bonfire", authprovider: AuthProvider.Guest)
);
var ecosystemWallet = await ConnectWallet(walletOptions) as EcosystemWallet; // or EcosystemWallet.Create
// This address will not change after linking i.e. in this case "upgrading" your account
var address = await ecosystemWallet.GetAddress();
Debug.Log($"Connected EcosystemWallet: {address}");
// This is how you display currently linked accounts
var linkedAccounts = await ecosystemWallet.GetLinkedAccounts();
Debug.Log($"Linked accounts: {Newtonsoft.Json.JsonConvert.SerializeObject(linkedAccounts)}");
// Create a raw EcosystemWallet to link, in this example user would have chosen to link Line
var ecosystemWalletToLink = await EcosystemWallet.Create(
client: ThirdwebManager.Instance.Client,
ecosystemId: "ecosystem.the-bonfire",
authProvider: AuthProvider.Line
);
// Use the Unity SDK helper to link the accounts
var newLinkedAccounts = await ThirdwebManager.Instance.LinkAccount(ecosystemWallet, ecosystemWalletToLink);
Debug.Log($"New linked accounts: {Newtonsoft.Json.JsonConvert.SerializeObject(newLinkedAccounts)}");
Additional changes
- Improved speed of NFT-related extensions.
- Fixed an issue with SIWE as an
AuthProvider
when usingThirdwebManager
to connect. - Added contract extensions
ERC721A_TokensOfOwner
&ERC721A_TokensOfOwnerIn
. - Added optional pagination to all
_GetAllNFTs
&_GetOwnedNFTs
extensions. - Improved ERC721A NFT-fetching speed.
Links
Unity v5 Portal Docs | .NET Portal Docs | .NET Full Reference
Note from Firekeeper
Our goal at thirdweb has always been to work for game developers - with such systems, you're able to offload all the account system, auth, database, item management, currency management, and analytics work to the blockchain. This is what we do, and we want to help you and listen to feed back - make sure you reach out, we have many programs to get you going!
We have the recipe to make blockchain games unbeatable, cheap, fast, invisible. Persistent In-App & Ecosystem Wallets paired with Account Abstraction, Session Keys and some easy to deploy contracts is what we do. It's all open-source, it's all yours to manage.
It's time to ditch external wallets.
Blockchain games can finally focus on being fun and on distribution across different runtime platforms and companion apps.
v5.0.2
What's Changed
- Removed redundant signature request when estimating gas or simulating user operations.
- Improved Metamask extension network switching behavior when already on the correct network.
v5.0.1
What's Changed
- Support for base64 token URIs in the context of getting NFTs from a contract that stores raw base64 metadata using our extensions.
NFTMetadata
now also returns a properties object alongside existing attributes.
v5.0.0
Stable Release - Thirdweb Unity SDK v5
With the release of our .NET SDK v2, the next generation of our Unity SDK is finally out of beta - no more platform specific updates!
This version comes with long-awaited features and various speed, stability and performance improvements.
This is a major version upgrade that comes with API breaking changes, be sure to cleanly remove old SDK files before upgrading.
Ecosystem Wallets
An ecosystem wallet is your own managed in-app wallet service that allows you to create a branded wallet and login system, and allow any number of partners to spin up in-app wallets. End users that create in-app wallets in your partner applications (either with email, phone number, socials or your own custom authentication) will receive one account and wallet address that they can access across all apps and games in your ecosystem.
Ecosystem Wallets use an enclave backend to handle private keys and signing, remaining non-custodial and secure, while also offloading the otherwise sharded wallet client side cryptographic work to a single http request - the ultimate cross-platform friendly account system.
You may upgrade these Ecosystem Wallets to Smart Wallets as you would any other wallet. The API is extremely similar to our In-App Wallets', and in some places simplified as well due to the streamlined infrastructure that powers it.
We've also reworked our login flows to increase speed and performance across the board, it's time to move on from external wallets (or just link them to our embedded wallets from now on through our Unified Identity system!)
Automatic Smart Wallet Network Switching
Given how our new SDK is structured, where no chain id is necessarily stored in the sdk or wallet's state, you may interact with any chain at will easily, setting up contracts or low level transactions across multiple chains and using a single wallet to execute them all.
Such functionality is now available seamlessly through our Smart Wallet offering. Simply create a smart wallet on any initial chain, and interact with any contract or send any transaction using another chain id - the smart wallet will automatically switch to that chain!
Do note that if you are overriding the default account factory in your connection parameters, that account factory must be deterministically deployed across the chains you are interacting with.
Unlocking low level transaction flows and zkSync specific flows
The ThirdwebTransaction.Create
inputs have been simplified, removing redundant chain id parameters.
We've also made it simpler to create low level transactions by adding ThirdwebTransactionInput
constructors that take in simpler types, and made zkSync transactions go through the EIP712 transaction flow regardless of whether you use a paymaster or not - this means you can override zkSync specific transaction variables like gas per pubdata and we'll still route your transaction through the 712 flow. If none of this made sense to you, don't worry, these are low level uncommon use cases.
Miscellaneous
[Utils] Added Utils.GetAddressFromENS
and Utils.GetENSFromAddress
- more info about ENS here.
[Utils] Added Utils.IsDeployed
as a standalone way to check if there is contract code at a specified address.
[AA] CallGasLimit UserOp value now accepts user estimated or manual gas limits as overrides automatically if it's above bundler esimated callGasLimit.
[RPC] Improved response time, batching and caching behavior.
Unity-Specific
[ThirdwebManager] Added EcosystemWalletOptions
as a parameter for when connecting to WalletProvider.EcosystemWallet
.
[ThirdwebManager] Added EcosystemWalletModal
prefab - similar to InAppWalletModal
, will spawn if using ThirdwebManager.ConnectWallet
with the respective wallet provider and otp-based authentication // fully customizeable, as are all things thirdweb. You may still opt to use our lower level .NET APIs and create your own flows.
[Extensions] Added Unity-specific extension for the NFT
type - NFT.GetNFTSprite
will return a Sprite loaded with your NFT's image.
Mandatory - Various Fixes & Performance Improvements
No, really. We're serious.
What's Next?
Now that the core is stable, we want to listen to your feedback, improve on all of it while also continuing to add features and unlock more functionality to help game developers, studios and publishers across the globe integrate the best tech ever created - blockchain tech.
UI Components are next, expect Scene_Playground
to be updated as we roll those out - first up, production ready, fully featured Connect.
Support
v4.20.1
What's Changed
- [Cross-Platform] Added support for new chains.
This patch also removes a duplicate DLL and incomplete third party prefabs making the import process in Unity 2021 a little easier.
v5.0.0-beta.4
What's Changed
Support for Account Abstraction 0.7.0 (EntryPoint 0.7.0)
You may now opt to use our new Account Factories that are built on top of the 0.7.0 ERC-4337 standard release, by passing Constants.ENTRYPOINT_ADDRESS_V07
as your entryPoint
parameter in SmartWallet.Create
or through the ThirdwebManager's ConnectWallet
function. Note that we will continue supporting AA 0.6.0 - so no rush.
Among various other things, this unlocks:
- Improved gas costs when interacting with Smart Wallets due to packed UserOp structs and more changes.
- Improved gas limit estimations and faster simulation.
- Token Paymasters - though not live on 0.7 until a little later, the API has been exposed to pass a
TokenPaymaster
(enum) when creating a Smart Wallet and choose which ERC20 you want users to pay gas with. This is an alternative to the default gasless flow where you sponsor gas for your users.
We've also added support for Abstract Testnet's native account abstraction (ZkSync-based chain).
Authentication
The new API for authenticating with your backend through SIWE in a single call looks like this now.
public static async Task<T> Authenticate<T>(
this IThirdwebWallet wallet,
string domain,
BigInteger chainId,
string authPayloadPath = "/auth/payload",
string authLoginPath = "/auth/login",
string authPayloadMethod = "GET",
string authLoginMethod = "POST",
bool separatePayloadAndSignatureInBody = false,
IThirdwebHttpClient httpClientOverride = null
)
We've made it a little more flexible so you can hopefully get rid of any custom authentication code you might have and use this helper instead to unlock backend thirdweb auth with any wallet easily.
We've also fixed an issue with some older variants of Smart Wallet factories which resulted in "Invalid SIgnature" being thrown upon personal signing (and by extension, authenticating).
API Improvements
- Low Level - Added
IThirdwebWallet.ExecuteTransaction
support for external and smart wallets to execute raw low level transaction input rather than going throughThirdwebTransaction
. - Low Level - Simplified the
ThirdwebTransactionInput
by adding a constructor with user friendly types. - Mid Level - Added
ThirdwebTransaction.Prepare
, allowing you to have a quick way to estimate, simulate and populate a transaction without sending it. - High Level - Deprecated
Utils.FetchThirdwebChainAsync
, please useUtils.GetChainMetadata
as the former will be removed in a future version.
General Improvements
- Stricter coding standards were implemented, making sure the core won't fail you regardless of which .NET version or platform you're on.
- Improved performance and stability across the board.
- Various minor bugfixes were implemented and a couple properties were renamed to improve DX.
.NET Docs: https://portal.thirdweb.com/dotnet
Unity v5 Docs: https://portal.thirdweb.com/unity/v5
v5.0.0-beta.3
What's Changed
Unity 6.0.0 Preview, SIWE as a login method, Account Linking
- Added support for Unity 6.0.0+ Preview (Unity 2023 Tech Stream 3)
- Added SIWE (Sign In With Ethereum) as an additional login provider for In-App Wallets.
// The external wallet you want to login with
var myExternalWallet = await PrivateKeyWallet.Generate(client: Client); // for simplicity, using generated wallet
// Setup auth with SIWE
var siweOptions = new InAppWalletOptions(authprovider: AuthProvider.Siwe, siweSigner: myExternalWallet);
// Setup connect options with chain ID
var connectOptions = new WalletOptions(provider: WalletProvider.InAppWallet, chainId: 421614, inAppWalletOptions: siweOptions);
// Login with SIWE!
var siweInAppWallet = await ThirdwebManager.Instance.ConnectWallet(connectOptions);
var address = await siweInAppWallet.GetAddress();
- Added ability to link accounts, creating a Unified Identity across email, phone, social and other authentication options.
// Your main InAppWallet account, already authenticated and connected
InAppWallet mainInAppWallet = ...
// An InAppWallet with a new auth provider to be linked to the main account, not connected
InAppWallet walletToLink = await InAppWallet.Create(client: Client, authProvider: AuthProvider.Telegram);
// Link Account - Headless version
var linkedAccounts = await mainInAppWallet.LinkAccount(walletToLink: walletToLink);
// Link Account - Unity wrapper version
var linkedAccounts = await ThirdwebManager.Instance.LinkAccount(mainInAppWallet, walletToLink);
// You can also fetch linked accounts at any time
List<LinkedAccount> linkedAccounts = await mainInAppWallet.GetLinkedAccounts();
The LinkAccount API requires the parameters you typically use to login with a normal InAppWallet. It will authenticate the new wallet and link it directly to the main wallet. This makes it simple to have multiple identities tied a single evm-compatible account.
Miscellaneous
- Performance and speed improvements for OTP based login methods.
- Added caching for
Utils.FetchThirdwebChainDataAsync
. - Added
Utils.IsEip155Enforced
to check whether a chain enforces EIP 155. - Added smarter transaction gas fee defaults based on whether chain supports 1559.
ThirdwebContract.Read
andThirdwebContract.Write
can now take in full or partial method signatures:var name = await contract.Read<string>(method: "name", ...)
still works.var name = await contract.Read<string>(method: "function name() view returns (string)", ...)
now also works.var name= await contract.Read<string>(method: "name() view returns (string)", ...)
now also works.var result = await contract.Write(..., method: "claim(address, uint256, address, uint256, (bytes32[], uint256, uint256, address), bytes)", ...)
now also works.- We still recommend using our awesome extensions for common standards such as
contract.DropERC20_Claim
to make life easier!
- Added support for ERC20 Paymasters.
v4.20
What's Changed
- [Native] Upgrade MetaMask SDK to 2.1.0 by @ecp4224 in #207
- Utilizes MetaMask's new ConnectWith functionality to connect and switch to the right network within a single call.
- Improves network switching behavior and handled errors better.
- Fixes errors encountered when switching to a MetaMask default chain such as Sepolia.
- Refactored internal code to use new MetaMaskSDK APIs.
- [Cross-Platform] Added support for new chains.
v5.0.0-beta.2
What's Changed
- Added
Farcaster
andTelegram
as additional InAppWalletAuthProvider
options.
Single DLL update, it's that easy with v5, works everywhere.
v5.0.0-beta.1
A New Era for Thirdweb's Unity SDK
We are thrilled to announce the beta release of our v5 SDK—our most significant update yet, set to redefine blockchain integration in gaming.
Building on our .NET SDK, we've minimized dependencies and reduced the package size by 90%. This beta is the first step toward truly unleashing the potential of blockchain technology in games, offering composable, simple, and clean APIs that can be utilized from anywhere.
Key Improvements
Unified API
- Seamless Integration Across Platforms: Enjoy a consistent experience across WebGL, Desktop, and Mobile without the need for the WebGL Bridge. Develop once, deploy everywhere.
Enhanced Composability
- Chain-Agnostic Interaction: Our APIs are designed to work seamlessly with multiple chains, removing the complexities of state management.
Native Experience
- Stable and Predictable Upgrades: Utilizing our .NET core, the SDK offers a native experience, ensuring stability and predictability with each upgrade.
Simplified ThirdwebManager
- Intuitive API Changes:
ThirdwebManager.Instance.SDK.GetContract
is nowThirdwebManager.Instance.GetContract
, returningThirdwebContract
.ThirdwebManager.Instance.SDK.Wallet.Connect
is nowThirdwebManager.Instance.ConnectWallet
, returningIThirdwebWallet
.
- Enhanced Wallet Management: Effortlessly manage multiple wallet connections and track the active wallet.
- Streamlined Setup: The prefab setup is now more intuitive, making it easier for developers to integrate and get started.
Optimized Package
- Lighter and Faster: A cleaner, lighter Unity package with minimal dependencies, significantly enhancing performance.
- Refined Architecture: We've taken control of all layers, excluding the AWS SDK and using Nethereum only for types/encoding. Libraries like Newtonsoft.Json and EDM4U are included to ensure efficiency.
Cross-Platform Consistency
- Uniform Behavior Across Platforms: Enjoy consistent behavior across all platforms—what you see in the editor is what you get in WebGL, Standalone, and Mobile runtime environments.
- Fully Customizable: The SDK can be white-labeled to match your branding needs.
Comprehensive Chain Support
- Universal Compatibility: All chains are supported, and no patches are needed to support newly deployed chains.
Join the Future of Blockchain Gaming
Our v5 SDK is still in active development, and we invite you to be part of this journey. For more details, visit our v5 branch readme.
Documentation and Support
- Unity SDK v5 Documentation: Read the Docs
- .NET SDK Documentation: Read the Docs
- Support and Feedback: Contact Support