Quick Start: Unity Apps
Early Preview Release
This feature of the Arcana Auth SDK is available only for Arcana Testnet as an early preview. Use it with caution. We are actively working on adding more functionality and fixes before making a formal release.
Web3 'Unity' gaming apps can integrate with the Arcana Auth Unity SDK and onboard users via social login. The authenticated users can access the Arcana wallet instantly within the app context and sign blockchain transactions.
1. Register & Configure
Begin by registering the app and configuring auth settings the Arcana Auth Unity SDK usage via the Arcana Developer Dashboard. Note the unique value, Client ID, assigned to the app. It is used later for app integration.
See how to configure user onboarding and gasless transaction settings Arcana Auth Unity SDK.
2. Unity Setup, Auth SDK Install
-
Install NuGetForUnity.
-
In the NuGet Toolbar at the top, click NuGet > Manage NuGet packages.
-
Install the following packages by STA:
Nethereum.Web3
,WebsocketSharp.Core
-
Use the Unity Editor Project Settings window to edit package settings for your project. Click Edit > Project Settings > Package Manager.
-
Edit Project Settings with URL https://npm-registry.arcana.network/ and set the scope to
com.cysharp.unitask, dev.voltstro
-
Add another new scoped registry with URL https://unitynuget-registry.azurewebsites.net and set the scope to
org.nuget
.
-
-
In the NuGet window, use the NuGet Toolbar at the top, and click Window > Package Manager > Add Package by Name.
-
Add the following packages:
com.cysharp.unitask
,`dev.voltstro.unitywebbrowser.engine.cef
-
Windows:
dev.voltstro.unitywebbrowser.engine.cef.win.x64
-
Linux:
dev.voltstro.unitywebbrowser.engine.cef.linux.x64
-
MacOS:
dev.voltstro.unitywebbrowser.engine.cef.macos.x64
-
See Unity Web Browser package list for details.
-
Download the Arcana Auth Unity SDK package: https://npm-registry.arcana.network/. Unzip the contents and copy them to the Assets folder of the Unity Project.
-
Search for ArcanaSDK prefab in the 'Project Window' of the Unity Editor. Click Assets > ArcanaSDK > Prefabs > ArcanaSDK. Drag this prefab into the project 'Hierarchy' and configure the prefab as shown here:
3. Integrate
Initialize the Arcana Auth Unity SDK by specifying the unique Client ID assigned to the app after registration.
using ArcanaSDK;
await arcanaSDK.InitializeSDK(env, "unique_clientID_for_registed_app");
Use latest SDKs
Use the latest Arcana Auth Unity SDK release v1.1.0 available at npm-registry.
Onboard Users
Call LoginWithSocial
or LoginWithOTP
to onboard the user. Choose one of the supported user onboarding options such as Google, Steam, etc.
// After initializing the SDK
if (loginMethod == LoginMethod.Passwordless)
arcanaSDK.LoginWithOTP(email);
else
arcanaSDK.LoginWithSocial(loginMethod);
Sign Transactions
Add code in authenticated user's context to call Request
method and make Web3 Wallet operation requests.
responseTextField.text = "";
if (parameters.text != null)
{
response = (await arcanaSDK.Request(new RequestParams {
Method = method.text,
Params = JsonConvert.DeserializeObject<object[]>(parameters.text)
})).ToString();
}
else
{
response = (await arcanaSDK.Request(new RequestParams {
Method = method.text,
})).ToString();
}
4. Deploy
Finally, deploy the app on Testnet (default). For Mainnet deployment, see Testnet > Mainnet Migration Guide.
That's all!
The Unity app is now ready to onboard users via the specified login method. Once the user logs in, the Arcana wallet will be instantly accessible for Web3 wallet operations within the app context.
See also
- 'Unity' integration example:
sample-auth-unity
submodule in Auth Examples - Arcana Developer Dashboard User Guide
- Configuring Arcana wallet visibility
- Developer's Guide for Arcana wallet
- Handling Arcana Auth SDK error messages
- Arcana Auth SDK Usage Guide
- Arcana Auth SDK Reference Guide
- Arcana Auth Wagmi SDK Reference Guide
- Arcana Auth Flutter SDK Reference Guide
- Enabling Gasless Operations in an App
- Arcana Gasless (Standalone) SDK Quick Start Guide
- Arcana Gasless (Standalone) SDK Usage Guide
- Gasless Error Messages