Skip to content
🎉 Welcome to the new Aptos Docs! Click here to submit feedback!
Build
Unity Integration

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

  1. Open Package Manager window (Window | Package Manager)
  2. Click + button on the upper-left of a window, and select Add package from git URL…
  3. Enter the following URL and click Add button
https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity

Open NuGetForUnity and install the Aptos SDK

  1. Click on Manage NuGet Packages from the NuGet menu in the Unity Editor.

launch-nuget

  1. Make sure to turn on Show Prerelease in the top left of the manager window.
  2. Search for Aptos and install the package.

search-aptos

Use the Aptos SDK

  1. 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.