Unity Bridge for Gaming
Utilize Tweed's SDK in a WebGL compiled Unity game
With the Unity bridge, developers can embed all of the blockchain and web3 functionalities found in Tweed's SDK into a WebGL-compiled Unity game. With a simple integration process, players can:
Own an in-game crypto wallet
Send and receive tokens and NFTs
Buy NFTs using their payment card
View their transactions
Play in a multi-chain environment (EVM and non-EVM)
Interact with smart contracts
And much more...
This is how it works:
The integration with the SDK doesn't change: a JS backend SDK and a frontend SDK will still need to be integrated into the platform, in addition to the following 3 files for the Unity bridge:
TweedSDK.cs
- Handles the calls to the SDK functions from the Unity MonoBehaviour objectTweedSDK.jslib
- Handles the communication from the Unity app to Tweed's frontend SDKTweedSDK.js
- Handles the communication from Tweed's frontend SDK to the Unity app
The Unity-JS bridge can be downloaded from our Unity bridge GitHub repo.
Unity Bridge Installation and Setup
Installation
The bridge should be incorporated into the Unity app to allow in-game blockchain functionality.
TweedSDK.cs
--><UnityProjectPath>/Assets/
TweedSDK.jslib
--><UnityProjectPath>/Assets/plugins
TweedSDK.js
--><FrontendProjectPath>
The first two files will get baked into the WebGL-compiled app using the Unity compiler. Compiling the Unity app will be done using: File --> Build Settings... --> WebGL --> Build The third file will get loaded into the frontend that hosts the Unity WebGL app using something like:
Usage Example
Use our JS documentation to learn about the SDK functionality. Every function is divided to two parts:
function_name
- calling the SDK functionfunction_name_cb
- a callback function that will have the returned data
Calling the following function:
Will return the wallet address in GetOrCreateWallet_cb
Last updated