> 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 XR 动画捕捉应用**录制的动画，让您的 Convai 虚拟形象在 Unity 中栩栩如生。本指南将介绍如何导入这些动画，并将其应用到 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 Controller**.
4. 将导入的动画剪辑拖入 **Animator Controller**.
5. 如果需要循环播放动画，请在动画设置中启用 **Loop Time** 。

***

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

1. 运行 Unity 场景。
2. 与虚拟形象开始对话，或触发已分配的动作。
3. 实时观看您的 AI 虚拟形象演绎录制的动画！

***

#### **完成！**

你现在已成功在 Unity 中将自定义的 VR 录制动画连接到 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.
