LYNC Unity Fuel SDK
Fuel Unity SDK is a no-code Modular Unity SDK supporting PC (MacOS and Windows) and Mobile (Android and iOS) on Fuel Blockchain.
Platform Supported: PC (Windows and MacOs) and Mobile (Android and iOS) Network Supported: Fuel Testnet and Mainnet (Coming Soon)
This release includes the following:
Social Logins
Fuelet Wallet Login
Custom Transactions in Social Login and Web3 Wallet like Fuelet
Paymaster inbuilt to sponsor transactions for your users.
Get your API Key
Please get your API key before downloading the SDK from here
Installation
Download the LYNC Unity Fuel SDK from Here
Example Project: https://github.com/LYNC-WORLD/Fuel-Unity-SDK
Import the SDK .unitypackage file to your project. or simply drag and drop .unitypackage file to your project.
Once the LYNC Fuel SDK package has finished importing into your Unity project, you can begin integrating it into your game.
The Folder structure looks like this
Integrating LYNC Fuel SDK in Unity
There is 1 Example Projects present in the SDK:
Assets/LYNC-FUELET-SDK/FUELET/Example.unity
You can find the example scene in the folders. Simply pass the API key in LyncManager GameObject.
To test, Build and Run after adding this scene in (Scene in Build).
Setup the Project
To use LYNC Fuel SDK. Attach LYNC Manager Prefab(Assets/LYNC-FUELET-SDK/LYNC Manager.prefab), on the starting scene. This will serve as the starting point for your project. In LYNC Manager Prefab, be sure to provide the following details:
LYNC API Key (The API Key can be generated from here)
Choose Network -> TESTNET
Sponsor Transactions -> If you want to sponsor transactions for users (Please contact LYNC to setup Paymaster)
Login Options -> Allowing users to choose which login method to login from
Pass a deep link name (example: lyncfuel/gameName etc.)
Integrating Login or Transaction Layer via LYNC Fuel SDK in Unity
The Sample Code for Login can be found at Example.cs.
Make sure to Import LYNC.
Example (Event Trigger):
LYNC ready Should be a function which has an argument of type "LyncManager"
To Check if the user is logged in or not:
To Login directly:
To Logout directly:
Transaction Flow:
ABI Fetcher
You will need ABI of the function to hit transaction, it's a rather complex process. To simply that, We have built a ABI Fetcher.
Link to ABI Fetcher: https://fuel-abi-fetcher.lync.world/
To get ABI of a function, pass Function Name and Contract ABI
For Example:
There are two methods for proceeding with a transaction:
Gasless Transaction - Game Developer/ Game Studio will be sponsoring the transaction fee.
User Paid Transaction- The Gamer/ User will be responsible for paying the gas fee and cost if any, required to do the transaction.
Gasless Transaction
To Enable Gasless Transactions or to Sponsor Transactions for your users, Set Sponsor Transactions as true, and contact LYNC team to setup your paymaster
To do transactions, Example.cs can be taken as a reference.
Pass in the Contract Address, Function Name, ABI of that function and Arguments.
Arguments are not compulsory parameters, but if the function accepts any argument, make sure to pass them.
You can create a public Transaction Object, pass in the parameters and hit the function call where you want to do the transactions
Or You can create a Transaction Object,
List of Arguments:
Some common bugs and their resolutions
Problem: Newtonsoft JSON is missing.
Solution: Please, Add this as a git URL in adding package
Last updated