> 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/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/scripting-reference.md).

# 脚本参考

Convai Unity SDK 提供了两种互补的 C# 集成方式。 `ConvaiSessionEventRelay`, `ConvaiCharacterEventRelay`，以及 `ConvaiTranscriptEventRelay` 它们是 MonoBehaviour，可在 Inspector 中直接连接事件——无需编写代码。对于脚本化响应和程序化控制， `ConvaiEvents` 类型化事件中心以及各组件的 C# API 可让任何脚本获得完整访问权限。两种方式都会监听相同的底层 SDK 事件，并可自由组合。

<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>会话事件</strong><br>通过中继组件或类型化 C# 事件中心获取连接状态、错误、空闲警告和参与者变更。</td><td><a href="/pages/6f90d2d448d0f65990aa0f30d6e9fd76263eea2e">/pages/6f90d2d448d0f65990aa0f30d6e9fd76263eea2e</a></td></tr><tr><td><strong>角色事件</strong><br>通过中继组件或类型化 C# 事件中心获取语音、情绪、转写、轮次生命周期和动作事件。</td><td><a href="/pages/d5d0bda9517e2ebcad589dcd94370c3d5b9a2130">/pages/d5d0bda9517e2ebcad589dcd94370c3d5b9a2130</a></td></tr><tr><td><strong>Transcript API</strong><br>用于查询并订阅实时内存中的转写时间线的拉取式外观。</td><td><a href="/pages/1a33f148fac3ddf7352a86abb1f67ce91973142c">/pages/1a33f148fac3ddf7352a86abb1f67ce91973142c</a></td></tr><tr><td><strong>Character &#x26; Player API</strong><br>用于……的完整方法、属性和事件参考 <code>ConvaiCharacter</code> 是位于 <code>ConvaiPlayer</code>.</td><td><a href="/pages/0b05353dc271e9a67f022bad20df0f61e55c2176">/pages/0b05353dc271e9a67f022bad20df0f61e55c2176</a></td></tr><tr><td><strong>ConvaiManager API</strong><br>SDK 入口点——连接控制、外观访问器、会话所有权和服务发现。</td><td><a href="/pages/837e187dde6ef107490d678933eda069ab0635b1">/pages/837e187dde6ef107490d678933eda069ab0635b1</a></td></tr><tr><td><strong>音频 API</strong><br>麦克风静音、按角色的音频控制、音频播放解锁和监听状态。</td><td><a href="/pages/bb7cdb69415400d0bfcff2641441af4bd4480284">/pages/bb7cdb69415400d0bfcff2641441af4bd4480284</a></td></tr><tr><td><strong>操作与流类型</strong><br>类型参考： <code>IConvaiOperation&#x3C;T></code>, <code>IConvaiStream&#x3C;T></code>, <code>ConvaiError</code>, <code>Unit</code>以及状态枚举。</td><td><a href="/pages/15b65578023dcda7a39e06f4214cfae613ce3123">/pages/15b65578023dcda7a39e06f4214cfae613ce3123</a></td></tr><tr><td><strong>异步模式</strong><br>消费 SDK 异步类型的六种模式：async/await、协程、链式调用、进度、取消和流。</td><td><a href="/pages/66f1c88f2864611c5d967825822213f8fa8fa8fa">/pages/66f1c88f2864611c5d967825822213f8fa8fa8fa</a></td></tr></tbody></table>

### 下一步

从以下开始 [会话事件](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/scripting-reference/session-events.md) 是位于 [角色事件](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/scripting-reference/character-events.md) 将 SDK 事件连接到你的场景逻辑，然后查看 [ConvaiManager API](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/scripting-reference/convaimanager-api.md) 用于连接控制，以及 [异步模式](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/scripting-reference/async-patterns.md) 页面以获取使用指南。


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/scripting-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
