> 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-unreal-engine-plugin/features/gaze-attention/gaze-attention-quick-start.md).

# 注视注意力快速开始

在 Convai Player Component 上启用注视注意力，并验证当玩家注视带标签的世界对象时角色会作出响应。

启用凝视关注功能 `UConvaiPlayerComponent`，为世界中的 Actor 添加标签，使其能够接收关注，并确认玩家持续注视对象后 Convai 角色会做出回应。完成后，玩家注视该 Actor 达到 `GazeAttentionDelay` 时长（默认值：1.0 秒）时，角色便会做出反应。

{% embed url="<https://youtu.be/Ffkzgof_wKw>" %}
Convai 对象关注功能演练
{% endembed %}

### 前提条件

启用凝视关注功能之前，请确认以下事项：

* 已安装 Convai Unreal Engine 插件并配置 API 密钥。请参阅 [安装 Convai 插件](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/getting-started/install-the-convai-plugin.md).
* 关卡中的 AI 角色上有一个 `UConvaiChatbotComponent` ，玩家 Pawn 上有一个 `UConvaiPlayerComponent` ，并且设置了有效的 `CharacterID` 且麦克风会话正常运行。
* **启用操作** 已在聊天机器人上勾选。在 **大纲视图**中选择聊天机器人，打开 `UConvaiChatbotComponent` 的 **细节** 面板，展开 **Convai | 操作** → **环境**，并确认 **启用操作** (`bEnableActions`）已启用。凝视关注会写入聊天机器人的关注槽，因此必须在连接会话时启用操作系统。如果尚未设置操作，请先参阅 [角色操作快速入门](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/character-actions/character-actions-quick-start.md) 。

{% hint style="info" %}
如果尚未为任何世界对象添加标签，请先完成 [场景元数据快速入门](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/scene-metadata/scene-metadata-quick-start.md) 再继续。凝视关注至少需要一个 `UConvaiObjectComponent` ，且其 **名称**.
{% endhint %}

### 不得为空。

{% stepper %}
{% step %}

#### 启用凝视关注并为对象添加标签

选择玩家 Pawn **大纲视图** （如果正在编辑蓝图，则选择 **内容浏览器**），打开包含 `UConvaiPlayerComponent`.
{% endstep %}

{% step %}

#### 的 Actor 或蓝图。

打开主开关 `在` 中选择 **详细信息** 面板。在 **Convai | 凝视注意力**中，检查 **启用凝视注意力** (`bEnableGazeAttention`）。默认值为 `false`；启用此项之前，其他凝视设置都会保持灰显。
{% endstep %}

{% step %}

#### 设置响应模式

将 **凝视时应响应** (`GazeShouldRespond`）设为 `Always`。默认值为 `Never`，此设置会静默更新注意力槽位，而不会要求角色进行口头回复。

在 **凝视注意力文本** (`GazeAttentionText`）中，输入一句简短的话，例如 `"The player is looking at this object."`。注意力提升时，Convai 会将此文本用作叙事事件。
{% endstep %}

{% step %}

#### 为场景中的 Actor 添加标签

点击关卡中的任意道具——箱子、门或设备。在 **详细信息** 面板中，点击 **添加组件** 并搜索 **Convai 对象组件**。选择它以添加 `UConvaiObjectComponent`.

展开 **Convai | 对象** 并设置：

* **名称** ——简短标签，例如 `"SafetyValve"`.
* **描述** ——一句话描述，例如 `"A red emergency valve on the west wall."`

在 **Convai | 对象 | 凝视**下，确认 **可凝视** (`bGazeable`）已勾选。当 `bGazeable` 为 `false`，该对象将完全从注视管线中排除。
{% endstep %}

{% step %}

#### 进入播放模式并注视该对象

按下 **播放**。将准星对准带标签的角色并保持不动。

你应该会看到三个阶段的反馈：

1. **立即** ——对象上会出现视觉高亮（UE 5.3 及更高版本中为淡黄色叠加层，UE 5.0–5.2 中为线框框），中心光标点会变为白色。
2. **经过 `GazeAttentionDelay` 秒** （默认 1.0 秒）后—— `OnAttentionGained` 触发，聊天机器人的注意力槽随之更新。
3. **片刻之后** ——角色开始说话，因为 `GazeShouldRespond` 设置为 `Always`.
   {% endstep %}
   {% endstepper %}

{% hint style="success" %}
注视注意功能正常工作时：准星进入对象的瞬间就会出现高亮，光标点会变为白色；持续注视 `GazeAttentionDelay` 秒后，角色便会开始说出回应。
{% endhint %}

如果始终没有出现高亮，请参阅 [注视注意故障排除](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/troubleshoot-gaze-attention.md)。如果出现了高亮但角色保持沉默，请确认已启用 **启用操作**, `GazeShouldRespond`和 `GazeAttentionText` （位于玩家组件上）。

### 后续步骤

{% content-ref url="/pages/d8a57f062e27764c8ec780df8b4e07d5b4d4282b" %}
[注视注意力的工作原理](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/how-gaze-attention-works.md)
{% endcontent-ref %}

{% content-ref url="/pages/797ae18ef94bcef2ec7816f079c7a35fb212a26c" %}
[注视注意力参考](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/gaze-attention-reference.md)
{% endcontent-ref %}

{% content-ref url="/pages/2f301cf695f654f0b6dc66672ff9462854021237" %}
[注视注意力使用示例](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/gaze-attention-usage-examples.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-unreal-engine-plugin/features/gaze-attention/gaze-attention-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.
