Getting Started
Set up the Estuary Unity SDK and run your first AI conversation in under 10 minutes.
Prerequisites
| Requirement | Details |
|---|---|
| Unity | 2022.3 LTS or newer (2021.3 minimum) |
| Estuary Account | Sign up at app.estuary-ai.com |
| API Key | Generated from your Estuary dashboard (est_... format) |
| Character ID | UUID of the AI character you want to use |
Installation
The SDK is distributed as a Unity Package Manager (UPM) package.
Via Git URL
The Estuary SDK works for text-only chat without any extra packages. To enable voice, add the optional LiveKit Unity SDK.
- Open your Unity project
- Go to Window > Package Manager
- Click the + button > Add package from git URL...
- Add the Estuary SDK:
https://github.com/estuary-ai/estuary-unity-sdk.git
- Click Add.
- (Optional, for voice) Add the LiveKit Unity SDK:
https://github.com/livekit/client-sdk-unity.git#v1.3.3
Dependencies
The following dependencies are installed automatically by UPM:
| Package | Version | Purpose |
|---|---|---|
com.unity.nuget.newtonsoft-json | 3.2.1 | JSON serialization |
com.unity.textmeshpro | 3.0.6 | Text rendering (for samples) |
The following dependency is optional -- only required for WebRTC voice:
| Package | Version | Purpose |
|---|---|---|
io.livekit.livekit-sdk | 1.3.3+ | WebRTC voice (optional) |
Auto-installer: On the first domain reload after adding the Estuary SDK, an Editor script (
EstuaryDependencyInstaller) checks whether the LiveKit Unity SDK is installed and shows a dialog offering a one-click install. The script uses Unity'sSessionStateso it only runs once per Editor session. You can decline -- the SDK still compiles and works for text-only chat. Without LiveKit, the optionalEstuary.LiveKitassembly is skipped (gated by theESTUARY_LIVEKITdefine), andEstuaryManager.IsLiveKitEnabledwill befalse.
Scene Setup
1. Create the EstuaryConfig Asset
- In the Project panel, right-click > Create > Estuary > Config
- Name it
EstuaryConfig - Select the asset and fill in the Inspector:
| Field | Value |
|---|---|
| Server Url | https://api.estuary-ai.com (or your self-hosted URL) |
| Api Key | Your est_... API key |
| Voice Mode | LiveKit (recommended) or WebSocket |
2. Add EstuaryManager
- Create an empty GameObject in your scene, name it EstuaryManager
- Add the Estuary Manager component (
Add Component>Estuary>Estuary Manager) - Drag your
EstuaryConfigasset into the Config field
The manager is a singleton that persists across scene loads. It coordinates the connection and routes events to characters.
3. Add EstuaryCharacter
- Select the GameObject that represents your AI character (or create a new one)
- Add the Estuary Character component
- Configure the fields:
| Field | Value |
|---|---|
| Character Id | Your character's UUID from the dashboard |
| Player Id | A unique ID for the end user (or leave blank for auto-generated) |
| Auto Connect | true to connect when the scene starts |
| Auto Start Voice Session | true if you want voice immediately |
Quick Test: Send Text
Create a test script to send a text message and see the response in the console:
using UnityEngine;
using Estuary;
using Estuary.Models;
public class QuickTest : MonoBehaviour
{
private EstuaryCharacter _character;
void Start()
{
_character = GetComponent<EstuaryCharacter>();
// Listen for responses
_character.OnBotResponse += HandleResponse;
_character.OnConnected += HandleConnected;
}
void HandleConnected(SessionInfo session)
{
Debug.Log($"Connected! Session: {session.SessionId}");
// Send a test message (text-only, no voice)
_character.SendText("Hello! Tell me a fun fact.", true);
}
void HandleResponse(BotResponse response)
{
if (response.IsFinal)
{
Debug.Log($"Character said: {response.Text}");
}
}
}
Attach this script to the same GameObject as your EstuaryCharacter, press Play, and watch the Console for the response.
Adding Voice
To enable voice conversations, add the audio components:
EstuaryAudioSource (TTS Playback)
- On your character GameObject, add Estuary Audio Source (
Add Component>Estuary>Estuary Audio Source) - An
AudioSourcecomponent is added automatically - Drag the
EstuaryAudioSourceinto the character's Audio Source field
EstuaryMicrophone (STT Input)
- On the same or a separate GameObject, add Estuary Microphone
- Drag your
EstuaryCharacterinto the Target Character field - Drag the
EstuaryMicrophoneinto the character's Microphone field
Enable Auto-Start Voice
On the EstuaryCharacter component, check Auto Start Voice Session. This will:
- Connect to the server
- In LiveKit mode: request a token, join the WebRTC room, and start native mic capture with AEC
- In WebSocket mode: start Unity microphone capture and stream audio
Verify It Works
Press Play. You should see console logs like:
[EstuaryManager] EstuaryManager initialized
[EstuaryCharacter] Connected: SessionInfo(SessionId=sid_abc, ...)
[EstuaryCharacter] Voice session started for <character-id>
[EstuaryMicrophone] LiveKit microphone active (AEC enabled)
Speak into your microphone and listen for the AI character's response through your speakers.
Next Steps
- Core Concepts -- Understand the SDK architecture
- Text Chat -- Build a text-based chat UI
- Voice Connection -- Deep dive into voice setup
- Action System -- Trigger animations from AI responses
- API Reference -- Full component documentation