Skip to content

Integrate Unity Gaming Services (UGS) in Unity

Overview

This is a sample project to showcase the Openfort integration with Unity Gaming Services, a complete service ecosystem for Unity live games.

The sample includes:

The sample uses Unity Authentication to sign in as a new anonymous player. It then creates an Openfort player and a custodial account using Openfort and it links it to the Unity player. Then the player can frictionlessly mint an NFT.

Application Workflow

Integration workflow

Prerequisites

Setup Openfort dashboard

Set up ugs-backend

Set up unity-client

Follow the official documentation steps to link the unity-client to your UGS Project ID.

Test in Editor

Play the Main scene and click Sign in button. After some authentication-related logs, this panel should appear:

Game Scene

Select Mint. After a brief period, you should see a representation of your newly minted NFT:

Mint Panel

In the Openfort Players dashboard, a new player entry should be visible. On selecting this player:

Player Entry

You'll notice that a mint transaction has been successfully processed:

Mint Transaction

Additionally, by choosing your Amoy Account and viewing NFT Transfers, the transaction is further confirmed:

Etherscan

Keep in mind that the sample is designed so a player can mint only once. By default, UGS Authentication will use the same player per device. If you want to sign in with a new player check the Clear Session Token in AuthController:

Clear Session Token

Conclusion

Upon completing the above steps, your Unity game will be fully integrated with Openfort and UGS. Always remember to test every feature before deploying to guarantee a flawless player experience.

For a deeper understanding of the underlying processes, check out the tutorial video.

Get support

If you found a bug or want to suggest a new [feature/use case/sample], please file an issue.

If you have questions, or comments, or need help with code, we're here to help: