Quickstart: Unity Integration
Get started with Openfort in your Unity project
1. Install the Openfort SDK#
Prerequisites#
The Unity SDK requires:
- UniTask package (version 2.3.3)
- Installation of git-lfs from git-lfs.github.com
There are two ways to install the SDK:
Since .dll files are stored on Git Large File Storage, you must download and install git-lfs from here.
- Open the Package Manager
- Click the add + button and select "Add package from git URL..." Enter https://github.com/openfort-xyz/openfort-csharp-unity.git?path=/src/Packages/OpenfortSDK and click 'Add'
2. Set your auth providers#
- Navigate to the auth providers page on the Openfort dashboard
- Click Auth providers Methods in the side bar in the players page
- Configure the methods you want users to be able to login with
3. Get your API keys#
In the API keys section, you'll find:
- Publishable Key: Safe to expose in client-side environment
- Secret Key: Must be kept secure and used only server-side
To generate non-custodial wallets:
- Scroll to the Shield section and click Create Shield keys
- Store the encryption share safely when it appears (you'll only see it once)
- You'll receive:
- Shield Publishable Key: Safe for client-side use
- Shield Secret Key: Keep secure, server-side only
4. Initialize Openfort in your Unity project#
Create a new script to manage the Openfort integration:
_14using Openfort.OpenfortSDK;_14using Openfort.OpenfortSDK.Model;_14_14public class OpenfortManager: MonoBehaviour {_14 private OpenfortSDK openfort;_14 const string PublishableKey = "YOUR_OPENFORT_PUBLISHABLE_KEY";_14 const string ShieldApiKey = "YOUR_SHIELD_PUBLISHABLE_KEY";_14 const string ShieldEncryptionShare = "YOUR_SHIELD_ENC_SHARE";_14 _14 private async void Start()_14 {_14 openfort = await OpenfortSDK.Init(PublishableKey, ShieldApiKey, ShieldEncryptionShare);_14 }_14}
Note for WebGL Projects
If you're developing for WebGL, check out the additional setup steps in the Unity WebGL documentation.
5. You're ready to build!#
With Openfort configured in your Unity project, you can now:
For a complete example of Openfort integration in Unity, check out our sample projects.