❗
This integration is currently in beta. Please report any issues you encounter by creating an issue in the aptos-labs/aptos-dotnet-sdk repository.
Integrating into Unity projects
This guide will walk you through the process of integrating the Aptos .NET SDK.
ℹ️
We are currently working on a .unitypackage
for Unity developers. In the
meantime, you can use the NuGet
package manager to install the SDK into your Unity project.
Install NuGetForUnity
- Open Package Manager window (Window | Package Manager)
- Click + button on the upper-left of a window, and select Add package from git URL…
- Enter the following URL and click Add button
https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity
Open NuGetForUnity and install the Aptos SDK
- Click on
Manage NuGet Packages
from theNuGet
menu in the Unity Editor.
- Make sure to turn on
Show Prerelease
in the top left of the manager window. - Search for Aptos and install the package.
Use the Aptos SDK
- Import the
Aptos
namespace in your C# script and use the SDK.
using UnityEngine;
using Aptos;
class Example : MonoBehaviour
{
public void Start()
{
PrintLedgerInfo();
}
async void PrintLedgerInfo() {
var client = new AptosClient(Networks.Mainnet);
var ledgerInfo = await client.Block.GetLedgerInfo();
Debug.Log(ledgerInfo.BlockHeight);
}
}
Next Steps
You’ve successfully integrated the Aptos .NET SDK into your Unity project. Now you can start building your game and interacting with the Aptos blockchain. Below are some resources to help you get started.