Skip to main content

Installation

Follow the steps to set up and start using the Unity ADK in your project.

1. Add via Unity Package Manager

Using UnityHub

2. Import the ADK into your project

Import the ADK in your Unity files to use the features provided by ART:

using ART.ADK

3. Configure Client Credentials

Once you have access to the ART Live Dashboard, generate the Client Secret and Create a credential object:

GetCredentials = () => new CredentialStore{
OrgTitle = "YOUR_ORG",
Environment = "YOUR_ENV",
ProjectKey = "YOUR_PROJECT_KEY",
ClientID = "xxxxxxxxxx",
ClientSecret = "xxxxxxxxxxx"
}

important

The adk-services.json needs to be updated with ProjectKey and Environment, manually. To learn how to obtain the values, click here

4. Authenticate

Once the Client Credentials are added to your project, the Client needs to be authenticated. To authenticate, user needs to generate passcode

var config = new AdkConfig{
Uri = "YOUR_SERVER_URI",
AuthToken = "YOUR_PASSCODE",
GetCredentials = () => "YOUR_CLIENT_CREDENTIAL"
};

// Initiate the connection to the ART server
adk.connect();

6. Subscribe to Channel

A Channel is a communication pathway that provides passage for data transfer. Subscribing to channel will allow you to get started with using the realtime messaging in your application.

// Subscribe to your channel
var sub = await _adk.Subscribe("your-channel-name");

You can learn more about Channel Configuration from here

6. Push Messages

Messages are pushed to a channel using the push() ADK method. This method allows you to send various event types with associated data, and optionally target specific users or groups within the channel for more granular delivery.


// Push a "message" event with the payload and targeting options
await sub.Push("message", new JObject
{
["text"] = "Hello from Unity!"
});

7. Listen to All Events and Messages

The listen() method allows you to capture all events and messages published within the subscribed channel. This is a catch-all listener that delivers every incoming payload, regardless of event type.

// Listen to all events and messages in the channel
sub.Listen(data =>
{
Log($"Event'{data}'");
});
note

You can refer the Quick Start Guide to understand the steps better.