> 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/ru-men/migrate-from-web.md).

# 迁移到 Creator Hub

将你的场景从 Web Editor 迁移到 Creator Hub。

如果你使用 Creator Hub 以外的工具创建了场景，可以轻松地将其迁移到 Creator Hub。

Creator Hub 是创建 Decentraland 场景的推荐工具。与 Web Editor 相比，它的界面更加完善，还能让你结合简单的拖放操作和通过代码进一步自定义的能力。此外，你还可以使用最新的桌面客户端运行场景预览。

## 从 Web Editor 迁移

要编辑使用 Web Editor 创建的场景中的代码，你必须先将场景导出到本机，然后使用 Creator Hub 打开。

{% hint style="warning" %}
**📔 注意**：如果尚未安装 Creator Hub，请在开始之前按照以下页面中的步骤操作。

[安装 Creator Hub](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/ru-men/editor-installation.md)
{% endhint %}

1. 编辑场景时，点击 Web Editor 顶部菜单中的 **下载图标** 。

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

2. 这会下载一个 *.zip* 文件，请将其解压。
3. 打开 **Creator Hub**，进入 **Scenes** 部分。
4. 点击 **Import Scene** 按钮，然后选择导出后的项目文件夹路径。

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

完成后，你就可以继续在 Creator Hub 中处理项目了。它的可视化界面与 Web Editor 十分相似，但更加完善。

你还可以编辑 `/src` 文件夹中的文件，通过代码为场景添加行为。有关如何编辑场景代码，请参阅 [与代码结合](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/shi-yong-dai-ma-kuo-zhan/overview.md) 。

## 迁移纯代码项目

你可以将任何纯代码项目导入 Creator Hub。操作方法如下：

1. 打开 Creator Hub，进入 **Scenes** 部分。
2. 点击 **Import Scene** 按钮，然后选择导出后的项目文件夹路径。

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

完成后，你就可以在 Creator Hub 中开始处理项目。你仍可使用自己喜欢的代码编辑器编辑场景代码，也可以使用命令行运行或部署场景。

导入项目后，通过代码创建的内容不会显示在 Creator Hub 画布上，也无法在画布上编辑，这可能会让你难以放置和对齐新项目。起初，你会看到一个空白网格场景。

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

你无需从头开始手动将内容添加到画布，而是可以运行命令自动添加。操作前，请确保已安装最新版本的 SDK，然后在终端中运行以下命令：

```
npx sdk-commands code-to-composite
```

{% hint style="danger" %}
**❗警告**：运行此命令前，请确保已备份项目。

此命令会使用新的快照覆盖 `main.composite` 文件。它还会注释掉 `.ts` 文件夹中的所有 `src` 文件中的代码。你需要取消代码注释，才能再次运行这些代码。
{% endhint %}

此命令会运行场景，并在第一帧对通过代码创建的内容进行快照。快照会保存到 `main.composite` 文件中，Creator Hub 会使用该文件显示场景内容。场景中的代码会被注释掉，以避免所有实体重复出现。

请注意，此命令只会捕获可在 Creator Hub UI 中呈现的实体及组件。它不会复制自定义组件，也不会重现实现逻辑的代码或通过代码创建的 UI 元素。要恢复被注释掉的行为，你需要编辑 `.ts` 文件夹中的 `src` 文件夹，并取消注释你需要的行。

你可能还需要重写部分代码，使其不再创建新实体，而是通过名称或标签引用现有实体，为它们赋予行为。请参阅 [与代码结合](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/shi-yong-dai-ma-kuo-zhan/overview.md) 了解如何在代码中获取这些实体。


---

# 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/ru-men/migrate-from-web.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.
