> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/jiao-hu-xing/custom-items.md). Agents can also search and read this documentation through its [MCP server](https://docs.decentraland.org/~gitbook/mcp).

# 自定义物品

创建你自己的自定义物品，以便在任何场景中重复使用。

定义自定义项，即可在任意场景中轻松重复使用，或与其他场景创作者分享。自定义项可以由单个实体组成，也可以包含任意数量的实体。自定义项可以是现有智能项的变体，也可以完全自定义，拥有专属模型和功能。

{% embed url="<https://www.youtube.com/watch?v=7cGLu8P7dso>" %}

## 如何定义自定义项

在 [实体树](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/ru-men/scene-editor-essentials.md#the-entity-tree)中的实体上单击右键，或选中多个实体后单击右键。选择 **创建自定义项**.

![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-e220cd72c1c4abd9921ab4f61c3f563a1bf1e88c%2Fcreate-custom-item.webp?alt=media)

随后，屏幕下方会提示你为新的自定义项命名。

![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-763f97263bcb03228513976115b70e7050231d33%2Fname-custom-item.webp?alt=media)

现在，该项会显示在屏幕底部的 **自定义项** 选项卡中。只有当工作区中至少存在一个自定义项时，才会显示此选项卡。

![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-ed63bf17467386a5b28302926d0d57d967578270%2Fcustom-items.webp?alt=media)

定义自定义项时，你可以选择同一层级的多个实体；但如果它们没有共同的祖先实体，就不能选择属于不同父实体的实体。所有嵌套实体都会自动包含在自定义项中，无需手动选择。

定义自定义项不会影响场景中的原始实体。

{% hint style="warning" %}
**📔 注意**：定义自定义项时，系统会快照所选实体上每个组件的状态（根实体的位置、旋转和缩放除外）。其中包括 **动作**, **触发器**, **多人游戏**, **脚本**, **可见性**以及其他所有组件。

所有智能项动作和触发器都会引用各自的副本。例如，如果你定义的自定义项包含一部电梯和一些按钮，那么每个电梯副本上的按钮都会控制所属的电梯副本，而不是原始电梯。
{% endhint %}

### 使用自定义项

只需将该项从 **自定义项** 选项卡拖入场景即可。

添加后，你可以随意修改自定义项的任何属性；所做的更改只会影响 *该副本* 。你也可以编辑或删除定义自定义项时使用的原始项，这不会影响现有或之后创建的副本。

请注意，自定义项在实体树中会以不同的图标显示。在右侧的项属性菜单顶部，你还会看到该项源自哪个自定义项。

若要删除自定义项定义，请在 **自定义项** 菜单中右键单击该项，然后选择 **删除**。此操作不会影响场景中已有的项副本；失去关联的自定义项会原样保留在场景中。删除自定义项定义只会将其从“自定义项”选项卡中移除。

若要重命名自定义项定义，请在 **自定义项** 选项卡中右键单击该定义，然后选择 **重命名**.

自定义项定义创建后便无法修改；你必须创建新的定义并删除原定义。

### 动态生成自定义项

每个自定义项都以复合体的形式存储，这是一个用于描述实体和组件树的文件。这意味着场景运行时，你可以生成新的自定义项副本，而不必手动放置每个副本。

你可以通过两种方式生成自定义项：

* **无需编写代码**：在场景编辑器中使用 **生成实体** 动作。请参阅 [关于生成实体](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/jiao-hu-xing/smart-items-advanced.md#about-spawning-entities).
* **使用代码**：使用 `Composite.instance()` 在 SDK 中。请参阅 [复合对象](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/jia-gou/composites.md).

### 共享自定义项

你可以与其他创作者共享自定义项，让他们在自己的场景中使用。

自定义项分别存储在本地计算机上的独立文件夹中。点击「自定义项」选项卡右上角的文件夹图标 <img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-498b8fc602219919fc16af2f71ffd39de109217b%2Ffolder-icon.png?alt=media" alt="Code" data-size="line"> 即可打开该文件夹。

你也可以在计算机上手动找到此文件夹：

* 在 Windows 中： *User/AppData/Roaming/creator-hub/Custom Items*
* 在 Mac 中： *Users/username/Library/Application Support/creator-hub/Custom Items*

{% hint style="warning" %}
**📔 注意**： *Library* 文件夹在 Mac 中默认处于隐藏状态。最简单的访问方式是打开「前往」>「前往文件夹」，然后输入 *application support/creator-hub*
{% endhint %}

要与他人共享，只需打开「自定义项」文件夹，并复制该项目的整个文件夹。你也可以将文件夹压缩成 ZIP 文件，以便传输。此文件夹包含使用自定义项所需的所有内容。

使用你的自定义项的人需要将项目文件夹解压到自己计算机上的「自定义项」文件夹中。他们可能还需要点击「刷新」按钮 <img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-405ad76a2a2c6c176d5dca56eed527976fee3325%2Frefresh-icon.webp?alt=media" alt="Refresh" data-size="line"> 才能让该项显示在他们的 **自定义项** 选项卡中。

自定义项使用的任何 **资源** 也存储在该自定义项的文件夹中。这包括该项目引用的任何 3D 模型、图像、脚本、声音和视频。


---

# 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.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/jiao-hu-xing/custom-items.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.
