> 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.md).

# Convai Unity SDK

为 Unity 训练模拟、交互式体验和游戏添加实时 AI 角色——支持语音、情绪、动作和持久记忆。

Convai Unity SDK 可将 Unity 项目连接到 Convai，为培训模拟、交互式体验和游戏带来对话式 AI。角色可实时处理语音、以自然语言回应，并同步口型、面部情绪和身体动画——所有功能均可按项目进行配置。每项功能都是独立模块：只添加项目所需的功能，并按照适合工作流程的顺序进行配置。

{% hint style="info" %}
**刚开始使用 SDK？** 请按照 [入门指南](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started.md) 安装软件包、配置 API 密钥并运行您的首个 AI 角色。
{% endhint %}

### 了解 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>了解 SDK 是什么、如何构成，以及何时使用各个模块。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/overview.md">Convai Unity SDK 概览</a></td></tr><tr><td><strong>兼容性和要求</strong><br>Unity 版本、渲染管线、平台支持和网络要求。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/compatibility-and-requirements.md">兼容性与要求</a></td></tr><tr><td><strong>核心概念</strong><br>会话生命周期、轮流对话模式和 SDK 事件系统。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/core-concepts.md">核心概念</a></td></tr><tr><td><strong>角色行为塑造</strong><br>用于角色行为的注视、身体动画、肢体语言、对话流程和情绪模块。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment.md">具身化</a></td></tr><tr><td><strong>AI 编码助手</strong><br>Unity MCP 集成，让 AI 编码代理能够根据提示构建 Convai 场景。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/ai-coding-assistant.md">AI 编码助手</a></td></tr></tbody></table>

### 功能

每项功能都是独立模块，可按需启用。

<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>角色可执行由 Convai 分发的结构化场景内命令。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/character-actions.md">角色动作</a></td></tr><tr><td><strong>情绪</strong><br>将 Convai 情绪信号映射到面部混合形状或 Animator 参数。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/embodiment/emotion.md">情绪</a></td></tr><tr><td><strong>长期记忆</strong><br>角色会记住每位玩家在不同会话中的信息。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/long-term-memory.md">长期记忆</a></td></tr><tr><td><strong>视觉</strong><br>角色可通过 Unity 摄像机、网络摄像头或 Meta Quest 透视功能进行观察。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/vision.md">视觉</a></td></tr><tr><td><strong>动态上下文</strong><br>随时将运行时状态和事件注入角色知识。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/dynamic-context.md">动态上下文</a></td></tr><tr><td><strong>叙事设计</strong><br>根据对话流程，通过触发器推进故事章节。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/narrative-design.md">叙事设计</a></td></tr><tr><td><strong>场景元数据</strong><br>角色会自动读取场景对象的上下文信息。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/scene-metadata.md">场景元数据</a></td></tr></tbody></table>

### 参考和指南

<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>UI 和呈现</strong><br>对话记录 UI、字幕模式、通知系统和设置面板。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/ui-and-presentation.md">UI 与呈现</a></td></tr><tr><td><strong>脚本参考</strong><br>会话事件、角色事件和对话记录系统的完整 API 参考。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/scripting-reference.md">脚本参考</a></td></tr><tr><td><strong>平台指南</strong><br>WebGL、Android、iOS 和 Meta Quest 部署指南。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/platform-guides.md">平台指南</a></td></tr><tr><td><strong>高级主题</strong><br>自定义提供程序、性能和 SDK 扩展点。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/advanced-topics.md">自定义并扩展 SDK</a></td></tr><tr><td><strong>故障排除</strong><br>常见故障模式、诊断步骤和已知问题。</td><td><a href="https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/troubleshooting.md">故障排查</a></td></tr></tbody></table>

### 最新版本

v<code class="expression">space.vars.unity\_sdk\_version</code> 引入了角色行为塑造模块系列，包括注视、身体动画、肢体语言、对话流程和情绪。这五个模块共用每个角色的一套配置，并读取相同的对话状态，因此角色的外观、动作和反应协调一致，而不是像五个彼此独立的行为。本次发布还新增了 Auth Token 身份验证模式，可在每次连接前获取短期有效凭据，因此玩家构建版本无需包含账户 API 密钥。动作编辑器经过重构，采用精选的 21 个内置动作目录，并可通过单个可撤销操作，为某个动作配置执行器及其角色端组件。新增的 `Convai > Troubleshooter` 窗口可按模块报告设置问题。SDK 要求使用 Unity <code class="expression">space.vars.unity\_min\_version</code>。请参阅 [发行说明](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/overview/release-notes.md) ，查看完整的变更日志。

### 后续步骤

通过“快速入门”部分安装 Convai Unity SDK，并连接你的第一个 AI 角色。如果你想在安装前评估 SDK，请查看 [兼容性和要求](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/compatibility-and-requirements.md) 以确认支持的平台和 Unity 版本。

{% content-ref url="/pages/5ea68df21c8a54f95779af92056a9ab831531be5" %}
[快速开始](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/getting-started.md)
{% endcontent-ref %}


---

# 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/zh/cha-jian-yu-ji-cheng/convai-unity-sdk.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.
