Thirdweb Manager
The ThirdwebManager
is a prefab that provides a convenient way to instantiate the ThirdwebClient, and contains helper functions to create contracts and wallets.
Add the prefab to your scene and the client will persist throughout your game's lifecycle, keeping track of your connected wallets.
It is entirely optional, and you can opt to use the .NET SDK directly if you prefer to do so.
Configure ThirdwebManager
through the Unity Inspector window.
Below is a list of all the settings you can adjust.
This section involves the basic settings to configure the SDK:
Client ID
: Thirdweb API Key. Used to access thirdweb services such as RPC, Storage, and Account Abstraction.Bundle ID
: The bundle ID used to access thirdweb services from native platforms. Should be the same as the bundle ID in your Unity project, e.g.,com.companyname.gamename
.Initialize On Awake
: Whether the SDK should initialize on awake or not. If not, you can callThirdwebManager.Instance.Initialize()
to initialize it manually.Show Debug Logs
: Whether to show thirdweb SDK debug logs.Opt Out Usage Analytics
: Whether to opt out of Connect usage analytics, such as the number of wallets connected to your game.
This section allows you to define WalletConnect-specific settings:
Supported Chains
: A list of chains that the wallets should be able to connect to by default. Each chain is defined by a chain ID.
Once your ThirdwebManager
is set up, you can interact with it using the following methods:
Initializes the SDK with the settings specified in the Unity Inspector.
Returns a ThirdwebContract instance that can be used to interact with a smart contract.
Returns the currently active wallet as an IThirdwebWallet
.
Sets the specified wallet as the active wallet.
Returns a wallet from the manager's wallet mapping by its address.
Adds a wallet to the manager's wallet mapping and returns the added wallet.
Removes a wallet from the manager's wallet mapping by its address.
Connects a wallet based on the specified WalletOptions
and returns an IThirdwebWallet
instance that can be used to interact with the blockchain.
Upgrades the specified wallet to a SmartWallet
, returning a SmartWallet
instance.
Links another InAppWallet
account to the main wallet and returns a list of linked accounts, allowing you to login with either authentication method later.
The InAppWalletModal
prefab is a simple and customizable OTP verification modal for InAppWallet
providers. It is used to verify and finalize the user's wallet connection.
It will be automatically activated when connecting to an InAppWallet
provider.
Similar use case as InAppWalletModal
, but for EcosystemWallet
providers.
The WalletConnectModal
prefab is an out-of-the-box WalletConnect modal that can be used to connect to 400+ wallets.
It will be automatically activated when connecting to a WalletConnect
provider.
Explore the .NET SDK to learn more about interacting with smart contracts, wallets, storage, RPC, account abstraction, and more.