> 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/spatial-awareness/merge-same-named-objects.md). Agents can also search and read this documentation through its [MCP server](https://docs.convai.com/api-docs/~gitbook/mcp).

# 合并同名对象

合并一堆同名对象，例如一堆箱子，使角色将整组视为一个逻辑整体。

默认情况下， `UConvaiObjectComponent` 名称相同的实例仍保持独立——第二个及之后的重复项会添加名称后缀，以便 AI 仍能分别定位每个实例。对于角色应视为一个整体的一堆道具（例如一叠板条箱或一排压力板），请改为启用 **与同名对象合并** 。本指南将合并一组同名对象，并说明如何在叠加层中确认合并结果。

### 前提条件

* 关卡中有两个或更多 Actor，每个都带有一个 `UConvaiObjectComponent`，且它们的 `Name` （位于 **对象条目** 中）相同（不区分大小写）。
* 项目已启用空间感知——请参阅 [空间感知快速入门](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/spatial-awareness/spatial-awareness-quick-start.md).

### 合并会带来哪些变化

在集合中的每个成员上启用 **与同名对象合并** 后，AI 对它们的感知方式会发生以下变化：

* 其位置为所有成员位置的平均值。
* 注视任意一个成员时，整个集合都会一并高亮显示，除非你将某个成员设为例外。
* AI 会收到整个集合的一条描述——取成员中第一个非空的 **描述** ，因此只需在其中一个成员上填写即可。
* 集合中的成员不会彼此添加后缀——它们有意共用一个名称。如果该名称仍与另一个独立的合并集合或未合并对象冲突，整个合并集合会共用一个后缀，以便仍可定位。

将 **与同名对象合并** 保持关闭（默认设置），同名对象就会保持独立，并通过 **重复名称后缀样式** 来区分——请参阅 [空间感知设置参考](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/spatial-awareness/spatial-awareness-reference.md).

### 合并一组对象

{% stepper %}
{% step %}

#### 为每个成员设置相同的对象条目名称

在集合中每个 `UConvaiObjectComponent` 上展开 **对象条目** 并设置相同的 **名称** ——例如，在这一堆中的每个板条箱上都设置为 `Crate` 。
{% endstep %}

{% step %}

#### 启用“与同名对象合并”

在这些组件的每一个上，展开 **Convai | 对象 | 分组** 并勾选 **与同名对象合并** (`bMergeWithSameNamedObjects`）。默认情况下，此选项未勾选。
{% endstep %}

{% step %}

#### 如果有多组对象，请设置合并组索引

如果关卡中有两堆彼此独立的道具，它们的对象名称相同且应分别合并，请设置 **合并组索引** (`MergeGroupIndex`，默认值 `0`）为每堆成员设置不同的值。对象只有在同时具有相同的 **名称** 和相同的 **合并组索引**。对于只有一堆对象的常见情况，请保留 `0` 。
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**合并组索引** 只有在 **与同名对象合并** 启用时才会生效；否则此选项会显示为灰色。
{% endhint %}

### 选择高亮行为

默认情况下，注视合并集合中的任一成员时，所有成员都会一起高亮显示。若要仅高亮玩家当前注视的对象，同时仍让整个集合以一个逻辑对象的身份进入 AI 的注意范围，请勾选该成员上的 **注视时仅高亮此对象** (`bHighlightOnlyThisWhenGazed`（位于 **Convai | Object | Gaze** 下）。此设置只会改变视觉高亮效果，纯属外观调整，不会影响未合并的对象。

### 验证合并结果

进入 Play 模式，并使用 [Convai 调试叠加层](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/troubleshooting/convai-debug-overlay.md) 按下 **Ctrl+Alt+K**打开。选择聊天机器人并查看 **周围环境** 面板：合并后的集合应以共享名称显示为单行，而不是每个箱子各占一行。其位置应显示在大致位于这堆对象中央的点上。

### 后续步骤

{% content-ref url="/pages/7e106191f2eaa9dd6a1b3cfbbbf3a7e6e171e3bf" %}
[空间感知的工作原理](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/spatial-awareness/how-spatial-awareness-works.md)
{% endcontent-ref %}

{% content-ref url="/pages/61357e0f0cdf694475bb5b1ab006fa4ae40d02e2" %}
[空间感知设置参考](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/spatial-awareness/spatial-awareness-reference.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/spatial-awareness/merge-same-named-objects.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.
