> 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/features/character-actions/quick-start.md).

# 角色动作快速入门

无需脚本，从 Actions Editor 的入门目录中为 Convai 角色添加一个现成动作，并确认其在 Play 模式下运行。

打开动作编辑器，并将其四个现成的入门动作之一添加到 Convai 角色上，无需编写脚本。最后，角色会对自然语言请求——例如“看向椅子”——作出响应，在你的场景中实际执行该行为。

### 前置条件

* [ ] 一个 `ConvaiCharacter` 你的 NPC 上已有的组件 `GameObject`，连接和响应对话。
* [ ] 角色应该能够作用的至少一个场景对象。

### 四个入门动作

动作编辑器会向每个尚未有动作的角色提供相同的四个入门项，按以下顺序排列：

| 入门   | 添加                                 | 角色所需的组件                                    | 它的作用                        |
| ---- | ---------------------------------- | ------------------------------------------ | --------------------------- |
| 走向目标 | `ConvaiWalkToActionExecutor`       | `ConvaiNavMeshLocomotion` 以及一个已烘焙的 NavMesh | 走向指定的物体、人物或地点，并在附近停下        |
| 跟随玩家 | `ConvaiFollowPlayerActionExecutor` | `ConvaiNavMeshLocomotion` 以及一个已烘焙的 NavMesh | 以舒适的距离跟随玩家，直到被要求停止          |
| 看向目标 | `ConvaiLookAtActionExecutor`       | `ConvaiGazeController` （凝视模块）              | 将角色的眼睛、头部和身体转向指定目标          |
| 播放手势 | `ConvaiPlayGestureActionExecutor`  | `ConvaiBodyAnimationController` （身体动画模块）   | 播放角色 Animation Set 中指定名称的手势 |

本页使用 **看向目标**：它不需要烘焙 NavMesh，而且结果——角色转头看向某物——在 Play 模式下会立刻显现。Walk To Target 和 Follow The Player 需要场景中已烘焙的 NavMesh（**Window > AI > Navigation**）之后角色才能真正到达任何地方；等你的场景里有了 NavMesh，再改选其中一个即可。

### 添加“注视目标”入门项

{% stepper %}
{% step %}

#### 标记一个目标对象

选择角色应该看向的对象——例如一把椅子。点击 **添加组件**，搜索 **Convai Action Target** (`Convai/Actions/Convai Action Target`），保留 **类型** current `对象`，并为它起一个清晰的 **名称**，例如 `椅子`.
{% endstep %}

{% step %}

#### 打开动作编辑器

选择 **Convai > 操作编辑器**。窗口打开时会自动选中场景中唯一的 `ConvaiCharacter` 已自动选中——如果你的场景里有多个，请从 **Character** 工具栏中的字段改选其他一个。
{% endstep %}

{% step %}

#### 在角色上启用动作

如果这是角色的第一个动作，窗口会显示一个一步式提示：点击 **启用动作**。这会添加 `ConvaiActionConfigSource` （标记为 **Convai Actions** （在 Inspector 中）添加到角色上——一次点击，完全可撤销。
{% endstep %}

{% step %}

#### 添加“注视目标”入门项

在还没有动作时，窗口会显示四张入门卡片： **走向目标**, **跟随玩家**, **看向目标**，以及 **播放手势**。选择 **看向目标**.

Convai 会创建一个 `注视` 由入门项预填好的动作，并添加 `ConvaiLookAtActionExecutor` 到角色上，并且——由于角色还没有 `ConvaiGazeController` ——也会一并添加，在同一个可撤销步骤中。
{% endstep %}

{% step %}

#### 添加一个 Convai Action Runner

将角色选择器下方的模式选择器从 **动作** 为 **角色设置**。如果列表中没有调度器，请点击 **添加动作运行器** 以添加 `ConvaiActionDispatcher` （标记为 **Convai 操作运行器** （在 Inspector 中）到角色上。
{% endstep %}
{% endstepper %}

### 验证设置

切回 **动作** 模式并选择 `注视` 左侧面板中的动作。其 **试一试** 框让你无需开始对话即可运行该动作：

* **在编辑模式下**，这是一个 **预览**：输入 `椅子` 到 dry-run 字段中，并确认它解析为你标记的目标。
* **在运行模式下**，这是一个 **测试运行**：选择 `椅子` 来自 **有效目标** 并点击 **立即运行**。角色应该会立即转向椅子，无需对话，也无需后端调用。

{% hint style="success" %}
**预期结果：** 进入 Play 模式并说“看向椅子。”角色的眼睛、头部和身体会转向它，而一旦视线稳定下来，动作就会报告成功。
{% endhint %}

如果角色没有转身，请打开 [排查角色动作](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/character-actions/debugging-and-troubleshooting.md) 查看诊断检查清单，或者选择 **Convai > 故障排查工具** 以一键式、检查清单风格对整个角色进行诊断。

### 下一步

{% content-ref url="/pages/b1d09b6e9430d66a69feaa877bc4844f6ed840d0" %}
[动作编辑器](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/character-actions/actions-editor.md)
{% endcontent-ref %}

{% content-ref url="/pages/f592d9dc3ad261e175159690b86cdd4b50bb4d81" %}
[动作执行器](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/character-actions/action-executors.md)
{% endcontent-ref %}

{% content-ref url="/pages/c5598abd0ddd72fa75a0989ad602a5b4d12e16d7" %}
[编写自定义动作执行器](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unity-sdk/features/character-actions/writing-custom-executors.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/features/character-actions/quick-start.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.
