The all-in-one package that takes your Unity games to the next level with basement integrations.
- Package built and tested on unity engine version
2021.3.45f1. Some functionalities might not be available in versions prior to 2021 - NewtonSoft JSON
- Download
b3-unity-sdk.unitypackagefrom this repository. - Open Unity and install the package either through package manager, or by double clicking the .unitypackage file and importing all the assets.
- For WebGL, the webgl template for B3 must be used IF webhook or window message APIs are used:
- Automatic management of basement user session and handling of auth token.
- WebGL support: retrieve the JWT from token parameter and maintain for API use.
- Native support: retrieve the JWT using sign in with browser, deep links, and automatic heartbeat for session persistance.
- Basement APIs:
- All basement launcher APIs are available as C# functions, with support for both await and callback-based asynchronous operations.
- Additional support for launcher modals such as tip, mint or swap via window message APIs (WebGL only, use http requests for native)
- Webhook support
- Webhooks in WebGL using window message API
- Webhooks natively, via deep links (WIP)
- All basement launcher APIs are available as C# functions, with support for both await and callback-based asynchronous operations.
- B3 Global Accounts
- Access to B3 Ecosystem Wallet via ThirdWeb SDK
- In your first scene, drag and drop the B3Instance prefab from the
b3-sdk/Prefabsfolder. - On the B3Instance GameObject, click on the B3 Config asset, select and, and fill in any details.
In order to call the B3 Launcher APIs for the user currently playing the game, a JWT token is needed for authentication. The SDK takes care of session management as follows, based on the target build platform:
All the available launcher APIs are defined in B3LauncherClient (must import namespace BasementSDK). They are configured to work either in asynhronous context with await, or via callback Actions.
Async/Await:
channelStatus = await B3LauncherClient.GetChannelStatus(new B3LauncherClient.GetChannelStatusBody { launcherJwt = SessionJWT }, null);
// your codeCallback Action:
B3LauncherClient.GetChannelStatus(new B3LauncherClient.GetChannelStatusBody { launcherJwt = SessionJWT }, (channelStatus) =>
{
// your code
});Each API endpoint has its own body type and return type definitions, which use NewtonSoft JSON for serialization/deserialization.
Webhooks are handled by the B3WebhooksHandler object. Attach your listeners to B3WebhooksHandler.OnWebhookReceived which will be called for every webhook received by the launcher. The default data returned is defined as
public class BaseWebhookData{
public string callbackType;
public string callbackUuid;
public string ruleActionType;
public object data;
}But you can further extend the class based on your needs and webhooks used (for example for sent custom activity the data object returned by the webhook contains the data of the new activity
The basement launcher is enriched with a lot of functionalities that can be triggered from within a game, enabling access to things like the tipping functionality, minting of assets, and other experiences. The modals can be opened via two methods, supporting both web requests, as well as faster propagation with the window messaging API. The following methods perform the same task:
B3LauncherClient.OpenTipModal(String.IsNullOrEmpty(otherWalletInput.text) ? "0xC5Ace087f703398F64FF9efdf9101edeF6390c9a" : otherWalletInput.text);B3LauncherClient.TriggerRulesEngine(new B3LauncherClient.TriggerRulesEngineBody
{
launcherJwt = B3Instance.Instance.SessionJWT ?? jwtInput.text,
trigger = "open-tip-modal",
otherWallet = otherWalletInput.text,
}, null);Of course the recommended approach is the messaging API (first example), while the second is more optimized for future usecases where there might be needed a more advanced UX.
- To use the B3 ecosystem wallet, you must first obtain your partner ID, and enter it on the B3 Config.
- Additionally you must get your client Id and bundle ID from the thirdweb dashboard and fill the details in the thirdweb manager component
- You can then call
B3EcosystemWallet.Instance.LoginViaMethod(), with a provided authProvider, which will begin the necessary flow to log in your user with ThirdWeb. - You can access the signed in ecosystem wallet via
B3EcosystemWallet.Instance.EcosystemWallet, which can be used with thirdweb APIs

