LYNC
DashboardSupport
  • 👋Introducing LYNC
  • Products
    • LYNC Account Abstraction SDK
    • LYNC Account Abstraction WebGL SDK
    • Metamask Wallet
    • LYNC Metamask PC SDK
    • OKX Wallet
    • LYNC In-Game Marketplace SDK
    • NFT Fetcher
    • No-Code Smart Contract Deployer
    • EVM Lootbox SDK
      • Getting Started
      • Using the SDK
        • Creating a new lootbox
        • Opening a lootbox
        • Claiming rewards
        • Whitelisting users using lootbox
        • Lootbox admin functions
        • Useful information functions from LyncLootBox class
        • Multicall : opening and claiming multiple lootboxes in a single transaction
      • Example Codes in React & TypeScript
        • Example code for creating a new lootbox
        • Example code for opening a lootbox
        • Example code for claiming a lootbox
    • Launch your products on Telegram
      • Configure Your Telegram Bot
      • Deploying Your Product on TG
  • APTOS
    • LYNC Paymaster - Supporting Aptos
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • Unity
        • API
        • JavaScript/ TypeScript
    • LYNC Unity Aptos SDK
    • Keyless Accounts
      • Configure Your OIDC Provider
      • Integrate Keyless in Unity
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
        • Send generic transactions on Aptos
    • LYNC Social Login SDK on Aptos
      • Getting Started
      • Using the SDK
      • Example Codes in React & TypeScript
      • Types Used in the Methods Provided by the SDK
      • Other Specification
    • LYNC Aptos Lootbox
      • Getting Started
      • Creating a Lootbox
      • Opening a Lootbox
      • Claiming the Rewards
      • Conclusion
  • Movement Labs
    • 📇Indexer
      • How to run index custom data?
      • Example Queries
        • Get Token Info
        • Get Token Balances
        • Get NFTs Owned by an Account
    • NFT Deployer
    • LYNC Social Login SDK on Movement
      • Getting Started
      • Using the SDK
      • Example Codes in React & TypeScript
      • Types and Enums Used in the Methods Provided by the SDK
      • Other Specification
    • LYNC Unity Movement SDK
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
    • LYNC Paymaster - Supporting Movement
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • JavaScript/ TypeScript
  • Supra
    • LYNC Paymaster - Supporting Supra L1
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • JavaScript/ TypeScript
    • LYNC Unity SUPRA SDK
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
  • Fuel
    • LYNC Unity Fuel SDK
    • LYNC NFT Deployer
      • Introduction
      • Getting Started
      • Deploying Your NFTs
        • Launch Your Entire Collection
      • Troubleshooting and FAQs
    • LYNC Fuel Lootbox
      • Getting Started
      • Creating a Lootbox
      • Opening a Lootbox
      • Claiming the Rewards
      • Conclusion
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
    • Fuel Marketplace NPM SDK
      • Getting Started
      • Using the SDK
        • Using hooks to get the marketplace data
        • Using services provided by the SDK to list, buy, and manage tokens
        • Some useful functions provided by the SDK
        • Error codes for the SDK
        • Interfaces and Enums provided by the SDK
      • Support
  • Metis
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
  • NPM Packages
    • Marketplace
      • Hook: useAllCollectionNFT
      • Hook: useAllBuyNFT
      • Hook: useAllOwnerNFT
      • Hook: useNFTDetails
      • Hook: useAllNFTForRent
Powered by GitBook
On this page
  • Get your API Key
  • Installation
  • Integrating LYNC Movement SDK in Unity
  • Setup the Project
  • Integrating Login or Transaction Layer via LYNC Aptos SDK in Unity
  • Transaction Flow
  • Gasless Transaction
  • Some common bugs and their resolutions
  1. Movement Labs

LYNC Unity Movement SDK

PreviousOther SpecificationNextWallet Creation and Transaction APIs

Last updated 14 days ago

LYNC Unity Movement SDK is a no-code Modular Unity SDK supporting PC (MacOS and Windows) , Mobile (Android and iOS) and WebGL on .

Platform Supported: PC (Windows and MacOs) , Mobile (Android and iOS) and WebGL Network Supported: Movement Testnet and Mainnnet

This release includes the following:

  • Social Logins

  • Custom Transactions in Social Login

Get your API Key

Please get your API key before downloading the SDK from

Installation

Download the LYNC Unity Movement SDK from

Example Project:

​Import the SDK .unitypackage file to your project or simply drag and drop .unitypackage file to your project.

Once the LYNC Movement 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 Movement SDK in Unity

There are 2 Example Projects present in the SDK:

  1. Assets/LYNC-Movement-SDK/Example/MoveExample.unity

  2. Assets/LYNC-Movement-SDK/Example/Example 2.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 Aptos SDK, attach LYNC Manager Prefab(Assets/LYNC-APTOS-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:

  1. Choose Network -> Testnet / Mainnet

  2. Pass a deep link name (example: lyncmovement/gameName etc.)

Integrating Login or Transaction Layer via LYNC Aptos SDK in Unity

The Sample Code for Login can be found at APTOSExample.cs.

Make sure to Import LYNC.

Example (Event Trigger):

LYNC ready Should be a function which has an argument of type "LyncManager"

LyncManager.onLyncReady += LyncReady;

private void LyncReady(LyncManager Lync)
    {
        // Once LYNC is ready, you can do any steps like Login, Logout, Transactions etc.
        
        //To Login:
        Lync.WalletAuth.ConnectWallet((wallet) =>
        {
            OnWalletConnected(wallet);
        });
        
        //To Logout:
        Lync.WalletAuth.Logout();
        
    }

To Check if the user is logged in or not:

using LYNC;

private AuthBase authBase;

    authBase = await AuthBase.LoadSavedAuth();
        if (authBase.WalletConnected)
        {
            // User is Already Login
            OnWalletConnected(authBase);
        }
        else{
             // Ask user to login
        }

On Wallet Connected (TypeOfLoginMethod)

//To OnWalletConnected(TypeOfLoginMethod):
        
        private void OnWalletConnected(AuthBase _authBase)
        {
            if (AuthBase.AuthType == AUTH_TYPE.FIREBASE)
            {
                Populate(_authBase as FirebaseAuth);
            }
        }
        

        public void Populate(FirebaseAuth firebaseAuth = null)
        {
            WalletAddressText.text = (firebaseAuth == null ? "Disconnected" : AbbreviateWalletAddressHex(firebaseAuth.AptosFirebaseAuthData.publicKey));
            balance.text = (firebaseAuth == null ? "0" : firebaseAuth.AptosFirebaseAuthData.balance) + " APT";
        }

To Logout directly:

LyncManager.Instance.WalletAuth.Logout();

Transaction Flow

There are two methods for proceeding with a transaction:

  1. Gasless Transaction - Game Developer/ Game Studio will be sponsoring the transaction fee.

  2. 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 do transactions, MoveExample.cs can be taken as a reference.

Pass in the Contract Address, Contract Name, Function Name and Network.

Arguments are not compulsory parameters, but if the function accepts any argument, make sure to pass them.

LyncManager.Instance.TransactionsManager.SendTransaction(Transaction);

You can create a public Transaction Object, pass in the parameters and hit the function call where you want to do the transactions

public Transaction mintTxn;

TransactionResult txData = await LyncManager.Instance.TransactionsManager.SendTransaction(mintTxn);

if (txData.success)
    SuccessfulTransaction(txData.hash, "MINT");
else
    ErrorTransaction(txData.error);

Or you can create a Transaction Object

public Transaction mintTxn;

//LyncManager.Instance.TransactionsManager.SendTransaction( new Transaction(ContractAddress, ContractName, FunctionName,ListOfArguments));

TransactionResult txData = await LyncManager.Instance.TransactionsManager.SendTransaction(
new Transaction("0x55db3f109405348dd4ce271dc92a39a6e1cbc3d78cf71f6bf128b1c8a9dfac33","tst_unity","set_data_bytes",arguments));

if (txData.success)
    SuccessfulTransaction(txData.hash, "MINT");
else
    ErrorTransaction(txData.error);

List of Arguments:

//List<TransactionArgument>{
//    new TransactionArgument{ argument = value, type = ARGUMENT_TYPE.STRING }
//};

List<TransactionArgument> arguments = new List<TransactionArgument>{
    new TransactionArgument{ argument = "0xb66b180422a4886dac85b8f68cc42ec1c6bafc824e196d437fdfd176192c25fccfc10e47777699420eec0c54a0176861a353a43dd45b338385e1b975709f2000", type = ARGUMENT_TYPE.STRING }
};

Some common bugs and their resolutions

Problem: Newtonsoft JSON is missing.

Solution: Please, Add this as a git URL in adding package

com.unity.nuget.newtonsoft-json

LYNC API Key ()

Sponsor Transactions -> If you want to sponsor transactions for users (Please contact to setup Paymaster)

To Enable Gasless Transactions or to Sponsor Transactions for your users, Set Sponsor Transactions as true, and

The API Key can be generated from here
LYNC
contact LYNC team to setup your paymaster
Aptos Move (M2)
here
Here
Assets -> Import Package -> Custom Package
SDK Folder Structure
Example Projects
Pass LYNC API Key
Sponsor Transactions
Transaction Object
Add newtonsoft Json