API Reference (WIP)
This page is still a work in progress. If you have any questions regarding the usage of the API, don't hesitate to contact us directly.
Session​
ISession​
A session is an interface that contains all the tasks currently used to interact with the Union Avatars API. It also handles logs and user authorization.
For more information about the Union Avatars API Endpoints check: Union Avatars API Docs
Session Context​
Class containing all the information needed to perform operations in the API.
Variables | Description |
---|---|
Url | Base URL of Union Avatars API |
UserToken | Container of the user’s API token |
AuthToken | SuperAuthorization token (Main API access) |
Server Session​
Implementation of ISession that performs client-side operations in the API. It makes use of Unity’s WebRequests using a helper class.
Creating and using a Session​
ServerSession session = new ServerSession();
await session.Login("username", "password");
AvatarMetadata[] avatarMetadatas = await session.GetAvatars();
If the server session does not meet your needs, you can create your own implementation using the provided session as a template. For example, you could create a client-server architecture where instead of letting the client perform the API requests directly, it redirects them to a game server with API credentials.
Avatars​
Avatar Importer​
Helper class that handles Runtime importing of GLTF data using GLTFast.
It contains methods that automatically convert the imported avatar binaries into a Unity Humanoid.
Importing an avatar​
var avatar = await session.GetAvatar(new System.Guid("AVATAR_ID"));
await AvatarImporter.ImportAvatarAsHumanoid(avatar, animatorController, cts.Token);
Importing an avatar using LOD​
var avatar = await session.GetAvatar(new System.Guid("AVATAR_ID"));
await AvatarImporter.ImportAvatarAsHumanoidLOD(avatar, animatorController, cts.Token);