Skip to main content

ConjureKit

The Unity SDK consists of a core package and a set of optional and recommended modules.



The core package com.aukilabs.unity.conjurekit functions as an entry point to the SDK. It holds libraries such as protobuf and other utilities, as well as the Hagall and HDS client.

ConjureKit modules are built on top of the core package to extend the functionality of the SDK.

While Auki Labs develops and publishes in-house developed modules (listed below) the SDK exposes the interfaces and primitives required for third-party developers to develop their own modules.

A message received by Hagall will be forwarded to all modules that subscribe to the range of the MsgType carried by the incoming message. Modules can also generate Msgs, Responses, ErrorResponses, and Broadcasts of their own.

Some modules also persist data in a server-side memory bucket called State, which is usually sent to a participant upon joining a session. However, this behavior is not currently open to third-party modules. Third-party modules must maintain all of their logic and state client-side.

Basic usage

Import

using Auki.ConjureKit;

Initialization

Use your own app_key and app_secret (cf. the quickstart guide):

public class Demo : MonoBehaviour
{
public Transform cameraTransform;

private IConjureKit _conjureKit;

private void Start()
{
var config = AukiConfiguration.Get();
_conjureKit = new ConjureKit(config, cameraTransform, "app_key", "app_secret");
}
}
note

ConjureKit requires a Camera reference. If you have an AR project, this will reference the camera from your AR scene rig. If you use the ConjureKit for a non-AR project, this can be any active camera in the scene.

Attach callback functions

_conjureKit.OnJoined += session =>
{
Debug.Log($"Joined Session: {session.Id}");
};

_conjureKit.OnLeft += () =>
{
Debug.Log($"Left Session");
};

ConjureKit provides many different callback functions to respond to messages in a session. Please see the Classes API reference for a full list of available callbacks.

Connect to the aukiverse

_conjureKit.Connect();

Once you are connected, you will be connected to a new session with a unique session id.

To connect to a specific session, you can pass the session id to the Connect method.

_conjureKit.Connect(_existingSessionId);

Add an entity

Pose pose = new Pose(Vector3.zero, Quaternion.identity);
bool persistent = false;
_conjureKit.AddEntity(pose, persistent,
(entity) => {
Debug.Log($"Successfully added entity {entity}");
},
error => {
Debug.Log($"Failed to add entity");
}
);

Update an Entity's Pose

_conjureKit.UpdateEntityPose(entityId, pose);

Delete an entity

_conjureKit.DeleteEntity(entityId,
() => {
Debug.Log($"Successfully deleted entity with id {entityId}");
}
);

Get all Entities created in a session

var session = _conjureKit.GetSession();
var entities = session.Entities;

The session contains information about the current session, such as participants, entities, etc.

Disconnect from the aukiverse

_conjureKit.Disconnect();