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

# 什么是 Convai Unity SDK

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

### 包含内容

该 SDK 随附完整的对话管线和一组可选启用的功能模块。

#### 对话管线

连接后始终处于活动状态：

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

#### 功能模块

可选启用，每个都作为 Unity 组件添加：

* **口型同步** — 实时 blend shape 口型动画；支持 ARKit、MetaHuman 和 CC4 Extended 映射
* **情绪** — 将 Convai 情绪信号映射到面部 blend shape 或 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 资源商店](https://assetstore.unity.com/packages/tools/behavior-ai/npc-ai-engine-dialog-actions-voice-and-lipsync-convai-235621).

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

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

### 下一步

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

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

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

{% content-ref url="/pages/5dbc3bfc03953952863c095fdc681a101736b9d2" %}
[Convai Unity SDK 架构](/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 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/overview/what-is-the-convai-unity-sdk.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.
