> 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/wu-dai-ma-ti-yan/convai-xr-animation-capture-app/adding-your-recorded-animations-to-ai-avatars-inside-unity.md).

# 在 Unity 中将录制的动画添加到 AI 头像

了解如何导入在 VR 中录制的动画并将其应用到 Unity 中的 AI 头像。

## **概述**

通过集成经由以下方式录制的动画，让你的 Convai 头像在 Unity 中栩栩如生 **Convai XR 动作捕捉应用**。本指南将带你导入这些动画，并将它们附加到 Unity 项目中的 AI 驱动角色上。

{% embed url="<https://youtu.be/dI3xf4gQPRE>" %}

## **如何在 Unity 中为 AI 头像添加录制的动画**

### **步骤 1：设置 Unity 和 Convai**

在导入动画之前，请确保你的 Unity 项目已正确设置好 Convai：

* 安装 **Convai Unity SDK**.
* 获取你的 **API 密钥** ，来自 Convai Playground。
* 将 API 密钥添加到你的项目设置中。

{% hint style="success" %}
**需要帮助设置 SDK 吗？**\
查看我们的 [Unity SDK 文档](https://docs.convai.com/api-docs/plugins-and-integrations/unity-plugin) 或按照上面的 [视频](https://youtu.be/anb9ityi0MQ) 操作步骤。
{% endhint %}

***

### **步骤 2：导入动画**

1. 前往 **Convai 控制台** 并导航到 **服务器动画** 选项卡。
2. 找到你在 VR 中录制的动画。
3. 点击 **导入** 并选择一个位置 **在你的 Unity 项目 `Assets/` 目录**.

{% hint style="warning" %}
这些文件 **必须放置在 Unity 项目文件夹内** ，这样它们才能被正确检测并使用。
{% endhint %}

***

### **步骤 3：将动画应用到角色**

1. 在 Unity 中，将你的 AI 角色模型拖入 **场景层级**.
2. 如有需要，调整角色的位置。
3. 打开或创建一个 **Animator 控制器**.
4. 将导入的动画片段拖入 **Animator 控制器**.
5. 如果动画应重复播放，请启用 **循环时间** 在动画设置中。

***

### **步骤 4：测试场景**

1. 运行你的 Unity 场景。
2. 与头像开始对话，或触发分配的动作。
3. 观察你的 AI 头像实时执行录制的动画！

***

#### **完成！**

你现在已经成功将一个自定义的 VR 录制动画连接到 Unity 中一个由 AI 驱动的头像。\
重复此过程可添加更多动画，并在你的模拟或游戏中创建丰富且富有表现力的角色。


---

# 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/wu-dai-ma-ti-yan/convai-xr-animation-capture-app/adding-your-recorded-animations-to-ai-avatars-inside-unity.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.
