> 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/scene-metadata/scene-metadata-component-reference.md).

# 场景元数据组件参考

Convai Object Component 的完整属性、函数和事件参考，包括对象标识、跟踪属性、接近状态和注视事件。

`UConvaiObjectComponent` 是你添加到任意 `Actor` 上的组件，可让 Convai 角色感知该对象。在内部，它是一个 `ActorComponent` （类组 `Convai`），会向 `UConvaiSubsystem`注册，并自动绑定 `ObjectEntry.Ref` 所属对象 `Actor` 当 `Ref` 未设置时，并向关卡中的每个 Convai 角色公开对象标识、实时状态属性和注视事件。

### 对象标识

该 `ObjectEntry` 属性（`FConvaiObjectEntry`）描述了 `Actor` 发送至 Convai。由于 `ObjectEntry` 使用 `ShowOnlyInnerProperties`，其字段会直接显示在“细节”面板中，而不是收纳在折叠的结构体下。

#### 核心身份字段

这些字段属于 `ObjectEntry`.

| 属性            | 类型        | 默认值 | 说明                                                                    |
| ------------- | --------- | --- | --------------------------------------------------------------------- |
| `Name`        | `FString` | —   | 聊天机器人用于指代此对象的显示名称。每个关卡中必须唯一； `UConvaiSubsystem` 自动重命名重复项，并在输出日志中写入警告。 |
| `Description` | `FString` | —   | Convai 在会话开始时收到的通俗易懂的描述。                                              |

#### 导航目标字段

这些字段用于控制 Convai 角色执行移动操作时如何移动到此对象。对于大多数对象，默认设置就足够了——只有在需要精确指定移动目标时才配置这些字段。它们属于 `ObjectEntry`.

| 属性                                                                  | 类型                             | 默认值           | 说明                                                                         |
| ------------------------------------------------------------------- | ------------------------------ | ------------- | -------------------------------------------------------------------------- |
| `ObjectReference` （蓝图显示名称 `Object Is`)                              | `EConvaiObjectReference`       | `Whole Actor` | 此对象对应 Actor 的哪一部分——整个 Actor，还是某个特定组件。控制未编写 `MovementPoints` 时 AI 如何导航到该对象。 |
| `AcceptanceRadius`                                                  | `float` （厘米）                   | `150`         | 移动到操作被视为完成时的距离，单位为厘米。                                                      |
| `ComponentName`                                                     | `FString`                      | —             | 用于指定以下内容的子组件目标： `Specific Component` 范围。留空则以角色原点为目标。                       |
| `SocketOrBoneName`                                                  | `FName`                        | —             | 匹配组件上的插槽或骨骼（`Specific Component` 范围内）。                                     |
| `MovementPoints`                                                    | `TArray<FConvaiMovementPoint>` | `[]`          | 为此对象手动设置的目的地。请参阅下文的 [移动点](#movement-points) 。                              |
| `Use Object as Fallback` (`bFallbackToObjectWhenPointsUnreachable`) | `bool`                         | `false`       | 当所有 `MovementPoints` 条目均不可到达时，改为走向对象本身，而不是报告对象不可到达。                        |

#### 对象引用

`EConvaiObjectReference` 用于控制在未设置 `MovementPoints` 时，Convai 如何为此对象指示 AI 导航：

* `Whole Actor` — AI 停在 `Actor`的碰撞边界处。适用于大型或环境类对象： `"去汽车那里"`, `"跟随玩家"`.
* `Specific Component` — AI 走到特定子组件的位置，也可以指定命名插槽或骨骼。适用于精确目标： `"站在门把手旁"`.

设置了 `MovementPoints` 后，它们会接管移动目标；而 `ObjectReference` 仅用于定义对象在注视和视觉方面的用途。

#### 移动点

MovementPoints `中的每个条目` (`FConvaiMovementPoint`) 都标记了角色走向此对象时的站立位置——例如，对于一扇门，可在门的两侧各设置一个。可在“细节”面板中编辑这些点，也可在选中对象时拖动视口可视化工具添加的抓取手柄。解析器会选取可到达且步行路径最短的点；如果所有点都已禁用，角色就会走到对象本身旁边。

勾选 `bCreatesSeparateDestination` （蓝图显示名称为 `Create Separate Destination`）可将某个点设为独立的命名目的地——例如，将电梯停靠层命名为 `Upper Landing` 后，就可以将 AI 指派到 `Elevator Upper Landing`，使其与电梯平台分开。

完整的 `FConvaiMovementPoint` 字段表，请参阅 [数据类型和枚举](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/blueprint-reference/data-types-and-enums.md).

### 跟踪的属性

`TrackedProperties` (`TArray<FConvaiTrackedProperty>`，类别为 `Convai|Object`) 保存附加到此对象的实时状态监视器列表： `Actor`.

| 字段                       | 类型                                             | 默认值     | 说明                                                 |
| ------------------------ | ---------------------------------------------- | ------- | -------------------------------------------------- |
| `PropertyPath`           | `FName`                                        | —       | 所属对象上的点分隔路径或函数名称： `Actor`。使用 **绑定** 面板中的按钮可正确填充此项。 |
| `Description`            | `FString`                                      | —       | 以通俗语言描述此属性的含义，供 AI 使用。                             |
| `StateValueDescriptions` | `TArray<FConvaiTrackedPropertyStateValueDesc>` | —       | 为枚举、布尔值或命名状态添加的逐值注释。在面板的 **高级** 部分显示。              |
| `ShouldRespond`          | `EC_RunLLMOption`                              | `Never` | 运行时值发生变化时的处理方式。                                    |

`FConvaiTrackedPropertyStateValueDesc` 包含两个字符串字段： `Value` （发送给 Convai 的字面值）和 `Description` （该值的通俗含义）。

#### `ShouldRespond` 选项

`EC_RunLLMOption` 控制聊天机器人在被跟踪的属性值发生变化时的行为：

* `Auto` — Convai 根据对话上下文决定是否作出反应。
* `Always` — 每次发生变化时，都会请求聊天机器人作出回应。
* `Never` — 静默更新该值；聊天机器人会收到通知，但不会发言。

会话开始时的初始值始终使用 `EC_RunLLMOption::Never` 无论 `ShouldRespond` 设置为何值，聊天机器人都会获知初始值，但不会作出反应。

### 移动感知

该 `MovementAwareness` 属性（`FConvaiObjectMovementSettings`，类别 `Convai\|Object\|Movement Awareness`）用于检测此对象的位置和旋转变化，并将简明的移动方向信息纳入空间上下文。

| 属性                                            | 类型                           | 默认值     | 说明                                                                                         |
| --------------------------------------------- | ---------------------------- | ------- | ------------------------------------------------------------------------------------------ |
| `bEnableMovementAwareness` （蓝图显示名称： `启用移动感知`) | `bool`                       | `true`  | 总开关。关闭后会移除移动相关描述和 `Movement` 状态，但不会影响常规的位置和可达性感知。                                          |
| `MovementSensitivity` (`灵敏度`)                 | `EConvaiMovementSensitivity` | `中`     | 设置达到何种程度的连贯平移或旋转才会被视为移动。值越高，越容易检测到细微动作；值越低，越能过滤物理漂移和碰撞抖动。                                  |
| `bExposeMovementState` (`添加移动状态`)             | `bool`                       | `false` | 添加 `<ObjectName>.Movement` 到上下文中，并使其可供“监视属性”操作使用。此选项还会报告已确认的停止状态。即使不启用此选项，空间事实中仍会包含移动方向描述。 |
| `StartedMovingResponse` (`移动开始时`)             | `EC_RunLLMOption`            | `Never` | 设置确认开始移动时是否应请求响应。仅在 `bExposeMovementState` 启用时生效。                                          |
| `StoppedMovingResponse` (`移动停止时`)             | `EC_RunLLMOption`            | `Never` | 设置确认停止移动时是否应请求响应。仅在 `bExposeMovementState` 启用时生效。                                          |
| `Delivery`                                    | `EConvaiContextDelivery`     | `正常发送`  | 设置响应式状态变化到达聊天机器人时的处理方式。仅在 `bExposeMovementState` 启用，且上方两个响应字段中至少有一个不为 `从不`.                |
| `bFlushImmediately` (`立即刷新`)                  | `bool`                       | `false` | 对响应式移动状态变化绕过常规上下文批处理。生效条件与 `Delivery`.                                                     |

`EConvaiMovementSensitivity` 各值按灵敏度从低到高排列： `极低`, `低`, `中`, `高`, `极高`.

### 距离和方向

Convai 对象组件不再为每个聊天机器人计算自身的邻近值。 `4.0.0-beta.22` 废弃了按对象计算邻近值的机制（`bAutoGenerateProximityState` 以及自动生成的 `"<ObjectName>.ProximityToYou"` 状态键）；这些功能在当前插件中均已不存在。现在，所有已注册对象的距离、方向、可达性和视线状态都由 [空间感知](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/spatial-awareness.md) 子系统集中计算，并作为常规上下文的一部分传递给每个聊天机器人。有关控制这些功能的项目设置，请参阅 [空间感知设置参考](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/spatial-awareness/spatial-awareness-reference.md) ；有关句子模型，请参阅 [空间感知的工作原理](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/spatial-awareness/how-spatial-awareness-works.md) 。

| 属性                         | 类型     | 类别                      | 默认值     | 说明                                                                           |
| -------------------------- | ------ | ----------------------- | ------- | ---------------------------------------------------------------------------- |
| `bDebugDrawProximityPaths` | `bool` | `Convai\|Object\|Debug` | `false` | 在编辑器视口中绘制每个已订阅聊天机器人到此对象的导航路径——可达时为绿色，不可达时为红色，聊天机器人已到达时为青色。不受其他任何设置限制。发布前请禁用。 |

### 注视

所有凝视属性和事件都位于 `Convai|Object|Gaze` 类别中。

| 名称                                      | 类型                       | 默认值    | 说明                                                                                                  |
| --------------------------------------- | ------------------------ | ------ | --------------------------------------------------------------------------------------------------- |
| `bGazeable`                             | `bool` 属性                | `true` | 设为 `false`时，凝视管线会完全跳过此对象——不会高亮显示、触发凝视事件，也不会提升其注意力优先级。对于那些应存在于 AI 环境中、但不应吸引玩家凝视的背景道具，请将其设为 `false` 。 |
| `OnGazedIn` / `OnGazedOut`              | `BlueprintAssignable` 委托 | —      | 当玩家的凝视进入或离开此对象时立即触发（早于注意力阈值被越过）。                                                                    |
| `OnAttentionGained` / `OnAttentionLost` | `BlueprintAssignable` 委托 | —      | 对象组件尝试向各聊天机器人分发通知后，在收到凝视注意力开始或结束通知时触发。                                                              |

有关完整的凝视管线、玩家端设置和故障排除，请参阅 [凝视注意力参考](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/gaze-attention/gaze-attention-reference.md).

### 蓝图函数

#### 对象函数（类别 `Convai|Object`)

| 函数                                                 | 返回                 | 说明                                                                   |
| -------------------------------------------------- | ------------------ | -------------------------------------------------------------------- |
| `GetResolvedComponent`                             | `USceneComponent*` | 返回目标场景组件；如果作用范围是整个 `nullptr` 则返回 `Actor` 。不接受任何参数；结果会缓存并自动重新验证。      |
| `AddTrackedProperty(InProperty)`                   | `bool`             | 在运行时添加一个受跟踪的属性。返回 `false` 如果路径在 `Actor`上不存在、类型不受支持，或者该路径已被跟踪。        |
| `RemoveTrackedProperty(PropertyPath)`              | `bool`             | 停止跟踪某个属性。如果该属性已移除，则返回 `true` 。                                       |
| `UpdateTrackedProperty(PropertyPath, NewSettings)` | `bool`             | 更新现有条目的 `Description`, `、`或 `ShouldRespond` 。路径是键；若要更改路径，请先移除，再重新添加。 |
| `GetTrackedProperties(OutProperties)`              | `void`             | 将当前跟踪属性列表的副本写入 `OutProperties`.                                      |

{% hint style="warning" %}
使用 `RemoveTrackedProperty` 移除跟踪属性，并不会从聊天机器人的上下文中清除该属性最近一次发送的值。该属性将不再更新，但聊天机器人仍会保留收到的最后一个值。设计属性移除流程时，请考虑这一点。
{% endhint %}

#### 注视功能（类别 `Convai|Object|Gaze`)

| 函数                                                      | 返回     | 说明                                                                                       |
| ------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------- |
| `NotifyGazeBegin(Player)`                               | `void` | 发出开始注视的信号。由 `UConvaiPlayerComponent`自动调用；也可以从自定义焦点系统调用。                                  |
| `NotifyGazeEnd(Player)`                                 | `void` | 与 `NotifyGazeBegin`.                                                                     |
| `NotifyGazeAttentionBegin(Player, Text, ShouldRespond)` | `void` | 通过子系统，请求在符合条件的聊天机器人中提升注视注意状态。此函数也 `BlueprintCallable` ，可用于电影摄像机或自定义焦点系统等非注视流程。           |
| `NotifyGazeAttentionEnd(Player)`                        | `void` | 解除注意状态。 `Player` 在 `nullptr` 销毁目标的情况下可能为 `OnAttentionLost` 的接收方必须在使用 `Player` 之前检查其是否为空。 |

### 相关参考

{% content-ref url="/pages/a6fd7e3b5ee94be300d9c248743b197b93cc0c96" %}
[场景元数据的工作原理](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/scene-metadata/how-scene-metadata-works.md)
{% endcontent-ref %}

{% content-ref url="/pages/4a8ee50a93a78b9b86484cb79897f6d0d6bde187" %}
[运行时管理环境](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/scene-metadata/managing-the-environment-at-runtime.md)
{% endcontent-ref %}

{% content-ref url="/pages/7fc985238017f8bd9de6df276f318c98902cac03" %}
[场景元数据使用示例](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/scene-metadata/scene-metadata-usage-examples.md)
{% endcontent-ref %}

{% content-ref url="/pages/10f005ecc29d44fa4ef4dd6d6ca9cf6c1c257d02" %}
[空间感知](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/spatial-awareness.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/scene-metadata/scene-metadata-component-reference.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.
