Prerequisites
Before you begin, ensure you have the following:- A Zero Runtime account (create one from the Zero Runtime Dashboard).
- Unity 2022.3 LTS or later.
- Python 3.11+ for the AI agent.
- A Google API Key for the Gemini Live API.
You need a Zero Runtime account to generate a token and a Google API key for the Gemini Live API.
Generate a token from the Zero Runtime Dashboard and a Google API key from Google AI Studio.
1. Unity Frontend
Step 1: Install the RTC SDK package
- Open Unity’s Package Manager by selecting from the top bar: Window -> Package Manager.
- Click the + button in the top left corner and select Add package from git URL.
- Paste the following URL and click Add:
- Add the
com.unity.nuget.newtonsoft-jsonpackage by following the instructions provided here.
Step 2: Platform setup
- Android
- iOS
To integrate the RTC SDK into your Android project, follow these steps:
- Add the following repository configuration to your
settingsTemplate.gradlefile:
settingsTemplate.gradle
- Install the Android SDK in
mainTemplate.gradle:
mainTemplate.gradle
- If your project has set
android.useAndroidX=true, then setandroid.enableJetifier=truein thegradleTemplate.propertiesfile to migrate your project to AndroidX and avoid duplicate class conflicts.
gradleTemplate.gradle
Step 3: Create a meeting room
Create a static Replace
roomId using the Zero Runtime API. Both the Unity app and the AI agent will use this ID to connect to the same meeting.YOUR_JWT_TOKEN_HERE with your Zero Runtime auth token. Copy the roomId from the response for the next steps.Step 4: Configure the Unity project
Update
GameManager.cs with your Zero Runtime auth token and the roomId you just created.Unity/Assets/Scripts/GameManager.cs
Step 5: Set up platform-specific permissions
- Android
- iOS
Add the following permissions to your
AndroidManifest.xml file:AndroidManifest.xml
2. Python AI Agent
Step 1: Setup the project
Use Python 3.11 or higher, then install the Zero Runtime Agents SDK. Create and activate a virtual environment, then install
zrt and python-dotenv. Every provider plugin ships with zrt.Step 2: Configure environment variables
Create a
.env file in the Unity-quickstart directory to store your keys and token securely for the Python agent:.env
Step 3: Create the AI agent backend
The Python agent joins the same meeting room to interact with the user. Create
agent-unity.py with your roomId.agent-unity.py
3. Run the Application
Step 1: Run the AI agent
Open a terminal, navigate to the
Unity-quickstart directory, activate your virtual environment, and run the agent. It reads GOOGLE_API_KEY from the .env file.Step 2: Run the Unity application
- Open the
Unity/project in Unity Hub. - Once the project is loaded, press the Play button in the Unity Editor to start the application.
- Click the Join Meeting button in the app to connect to the session.
Troubleshooting
'Waiting for participant...' but no connection
'Waiting for participant...' but no connection
- Ensure both the Unity application and the agent are running.
- Check that the
roomIdmatches inGameManager.csandagent-unity.py. - Verify your Zero Runtime token is valid.
Audio not working
Audio not working
- Check platform permissions for microphone access (see Step 5 in Part 1).
- Ensure your Google API key has Gemini Live API access enabled.
Agent not responding
Agent not responding
- Verify your
GOOGLE_API_KEYis set in the.envfile. - Check that the Gemini Live API is enabled in your Google Cloud Console.
Next Steps
Quickstart Example
Complete working example with source code.
Build Your First Voice Agent
Learn the Cascade and Realtime pipelines in depth.