> 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

面向 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 资源商店](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 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.
