Unity SDK
Load your Ava-Twin avatar into any Unity scene in minutes. The SDK handles customizer integration, GLB downloading, humanoid setup, animations, and caching.
Installation
Install via Unity Package Manager (UPM) using a Git URL:
- 1. In Unity, open Window → Package Manager.
- 2. Click + and select Add package from git URL…
- 3. Paste the following URL and click Add:
https://github.com/waqaszs/ava-twin-unity-sdk.git#v1.0.0
Demo Scene
The SDK ships with a ready-to-play demo scene. After installing, open Window → Package Manager, select the Ava-Twin SDK, go to the Samples tab, and click Import next to Demo Scene.
Quick Start
- 1. In Unity, go to Ava-Twin → Setup from the menu bar. Enter your App ID and API Key from your dashboard.
- 2. Call
await SDK.OpenCustomizerAsync()to open the customizer and receive the avatar:
using AvaTwin;
using UnityEngine;
public class AvatarLoader : MonoBehaviour
{
[SerializeField] private Transform playerTransform;
[SerializeField] private Animator animator;
async void Start()
{
var result = await SDK.OpenCustomizerAsync();
if (result != null)
{
result.Root.transform.SetParent(playerTransform);
var humanoid = result.GetUnityHumanoidAvatar();
if (humanoid != null)
{
animator.avatar = humanoid;
animator.Rebind();
}
}
}
}Credentials ScriptableObject and exclude it from version control via .gitignore.API Reference
CharacterLoader — Methods
CharacterLoader — Events
SDK.OpenCustomizerAsync() or SDK.LoadAvatar() instead.CharacterLoader — Properties
CharacterLoader — Inspector Fields
SDK — Static Methods
The SDK static class provides the primary async/await API for loading avatars. These are the recommended entry points for most use cases.
using AvaTwin;
using UnityEngine;
public class QuickLoad : MonoBehaviour
{
[SerializeField] private Animator animator;
async void Start()
{
var result = await SDK.OpenCustomizerAsync();
if (result != null)
{
result.Root.transform.SetParent(transform);
var humanoid = result.GetUnityHumanoidAvatar();
if (humanoid != null)
{
animator.avatar = humanoid;
animator.Rebind();
}
}
}
}AvatarResult
Returned by SDK.OpenCustomizerAsync() and SDK.LoadAvatar(). Contains the instantiated avatar and metadata needed for animation, persistence, and networking.
AvaTwinCharacterController
A third-person character controller included in the SDK demo. Drives a humanoid Animator with four parameters: Speed, Grounded, Jump, and FreeFall.
AvaTwinInput
Input data struct consumed by AvaTwinCharacterController.
Platform Notes
SDK.cs CheckPlatformSupport) — Studio+ plan tier supports identifier registration, but full SDK support is coming.- The customizer opens as an iframe overlay. The SDK uses postMessage for iframe communication.
- Register your origin in Console (e.g. mygame.com or *.mygame.com). Local dev (localhost, 127.0.0.1) is auto-allowed.
- Enable Brotli compression in Player Settings for smaller builds. Avatars are cached in IndexedDB across browser sessions.
- The customizer opens as a native in-app UI with category tabs (head, top, bottom, shoes), a skin tone picker, and a drag-to-rotate avatar preview. The mobile customizer prefab loads automatically from Resources — no Inspector configuration needed.
- Register your Java package name (Android) or CFBundleIdentifier (iOS) in Console — must match your build's Application.identifier.
- Same SDK.OpenCustomizerAsync() and SDK.LoadAvatar() API as WebGL. GLB downloads use UnityWebRequest (no CORS restrictions on native mobile).
- Calling SDK.OpenCustomizerAsync() in the Editor auto-loads a random avatar for quick iteration. No browser or iframe is opened.
- Editor mode bypasses identifier checks — Console registration is not required for editor work.
- Use LoadCharacterFromUrl() to test with a specific avatar.
- Currently blocked at the SDK level (SDK.cs CheckPlatformSupport).
- Studio+ plan tier supports identifier registration; full SDK support is coming.
Full setup guide at Registering Build Identifiers.
Troubleshooting
For step-by-step setup, see Registering Build Identifiers.