> 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 头像

## **概述**

通过集成使用以下方式录制的动画，让你的 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 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/wu-dai-ma-ti-yan/convai-xr-animation-capture-app/adding-your-recorded-animations-to-ai-avatars-inside-unity.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.
