> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference.md).

# Scripting reference

Reference for the Convai Unity SDK C# scripting APIs — events, transcripts, audio control, and async operation patterns.

The Convai Unity SDK exposes two complementary approaches for C# integration. `ConvaiSessionEventRelay`, `ConvaiCharacterEventRelay`, and `ConvaiTranscriptEventRelay` are MonoBehaviours that wire events directly in the Inspector — no code required. For scripted reactions and programmatic control, the `ConvaiEvents` typed event hub and each component's C# API give full access from any script. Both approaches observe the same underlying SDK events and can be combined freely.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Session events</strong><br>Connection state, errors, idle warnings, and participant changes via relay component or typed C# hub.</td><td><a href="/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/session-events.md">Session events</a></td></tr><tr><td><strong>Character events</strong><br>Speech, emotion, transcript, turn lifecycle, and action events via relay component or typed C# hub.</td><td><a href="/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/character-events.md">Character events</a></td></tr><tr><td><strong>Transcript API</strong><br>Pull-based facade for querying and subscribing to the live in-memory transcript timeline.</td><td><a href="/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/transcript-api.md">Transcript API</a></td></tr><tr><td><strong>Character &#x26; Player API</strong><br>Full method, property, and event reference for <code>ConvaiCharacter</code> and <code>ConvaiPlayer</code>.</td><td><a href="/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/character-and-player-api.md">Character and Player API</a></td></tr><tr><td><strong>ConvaiManager API</strong><br>SDK entry point — connection control, facade accessors, conversation ownership, and service discovery.</td><td><a href="/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/convaimanager-api.md">ConvaiManager API</a></td></tr><tr><td><strong>Audio API</strong><br>Microphone muting, per-character audio control, audio playback unlock, and listening state.</td><td><a href="/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/audio-api.md">Audio API</a></td></tr><tr><td><strong>Operation &#x26; stream types</strong><br>Type reference for <code>IConvaiOperation&#x3C;T></code>, <code>IConvaiStream&#x3C;T></code>, <code>ConvaiError</code>, <code>Unit</code>, and status enums.</td><td><a href="/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/operation-and-stream-types.md">Operation and stream types</a></td></tr><tr><td><strong>Async patterns</strong><br>Six patterns for consuming SDK async types: async/await, coroutines, chaining, progress, cancellation, and streams.</td><td><a href="/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/async-patterns.md">Async patterns</a></td></tr></tbody></table>

### Next steps

Start with [Session Events](/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/session-events.md) and [Character Events](/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/character-events.md) to wire SDK events to your scene logic, then explore the [ConvaiManager API](/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/convaimanager-api.md) for connection control and the [Async Patterns](/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference/async-patterns.md) page for consumption guidance.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.convai.com/api-docs/plugins-and-integrations/convai-unity-sdk/scripting-reference.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
