> 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/overview/what-is-the-convai-unity-sdk.md). Agents can also search and read this documentation through its [MCP server](https://docs.convai.com/api-docs/~gitbook/mcp).

# 什么是 Convai Unity SDK

面向 Unity 的实时对话式 AI 角色——语音管线、可选功能模块、支持的平台和最低要求。

Convai Unity SDK 可将 Unity 角色连接到 Convai，使其能够实时说话、聆听、推理和行动。玩家对着麦克风说话后，SDK 会采集音频并将其流式传输到 Convai，以进行语音识别和语言理解；随后生成语音合成回复，并通过角色播放，同时同步口型、面部情绪以及可选的场景内动作。该 SDK 面向使用 Unity 构建培训模拟、交互式体验和游戏的开发者。

### 包含的功能

SDK 提供完整的对话流程以及一组可选择启用的功能模块。

#### 对话流程

连接后始终启用：

* **实时语音输入** — 麦克风采集、流式语音识别
* **语言理解与生成** — Convai 以角色身份进行处理并作出回应
* **文本转语音** — 由 Convai 生成语音，并通过 Unity 音频播放

#### 功能模块

按需启用，每个模块都作为 Unity 组件添加：

* **口型同步** — 实时混合形状嘴部动画；支持 ARKit、MetaHuman 和 CC4 Extended 映射
* **情绪** — 将 Convai 的情绪信号映射到面部混合形状或 Animator 参数
* **动作** — 角色执行由 Convai 分发的结构化场景内命令
* **长期记忆** — 角色会在不同会话中记住每位玩家
* **叙事设计** — 根据对话流程，通过触发器推进故事章节
* **视觉** — 角色通过 Unity 摄像机、网络摄像头或 Meta Quest 透视功能进行观察
* **动态上下文** — 随时将运行时状态和事件注入角色的知识中

#### 实用工具

可选辅助工具，完全在 Unity 中运行，无需与 Convai 通信：

* **对话动画** — 四层 Animator 堆栈，在说话期间驱动身体和头部动作
* **注视与注意力** — 将眼睛和头部的注视动作混合，使其朝向焦点目标和对话对象

#### 编辑器工具

项目设置中的 API 密钥配置、场景设置菜单、场景验证器，以及适用于每个 SDK 组件的自定义 Inspector。

### 语音 → Convai → 角色流程

```mermaid
graph LR
    MIC[麦克风] --> RM[ConvaiRoomManager]
    RM --> |语音流| CLOUD[Convai]
    CLOUD --> |音频 + 元数据| CHAR[ConvaiCharacter]
    CHAR --> AUD[音频播放]
    CHAR --> MOD[功能模块]
```

`ConvaiRoomManager` 负责处理与 Convai 的流式连接。 `ConvaiCharacter` 接收回复内容——音频、转录文本、情绪信号和动作命令——并将每项内容路由到相应的模块或输出。

### 要求

| 要求       | 最低要求                                                           |
| -------- | -------------------------------------------------------------- |
| Unity 版本 | <code class="expression">space.vars.unity\_min\_version</code> |
| 渲染管线     | 内置、URP 或 HDRP                                                  |
| 平台       | Windows、macOS、Linux、Android、iOS、Meta Quest、WebGL               |
| 网络       | 连接到 Convai 的互联网连接                                              |
| API 密钥   | 免费账户，注册网址： [convai.com](https://www.convai.com/)               |

{% hint style="info" %}
示例场景使用 URP。如果项目使用内置渲染管线，示例需要进行少量材质重新分配。SDK 本身兼容这三种渲染管线。
{% endhint %}

Convai Unity SDK 可在 [Unity Asset Store](https://assetstore.unity.com/packages/tools/behavior-ai/npc-ai-engine-dialog-actions-voice-and-lipsync-convai-235621).

完整的平台和 Unity 版本支持矩阵，请参阅“兼容性和要求”。

{% content-ref url="/pages/55576a48120f0ea393eac65ad3f16a76f2c8b45b" %}
[兼容性与要求](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/compatibility-and-requirements.md)
{% endcontent-ref %}

### 后续步骤

安装 SDK 并添加你的第一个角色。

{% 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 %}

在开始设置之前，若要了解系统架构，请接着参阅架构页面。

{% content-ref url="/pages/5dbc3bfc03953952863c095fdc681a101736b9d2" %}
[Convai Unity SDK 架构](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/overview/convai-unity-sdk-architecture.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/overview/what-is-the-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.
