> 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/kai-shi-shi-yong/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](/creator/content-creator-zh/chang-jing-bian-ji-qi/kai-shi-shi-yong/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-60c2ed69a5172f033eb1fb47980323cc50f21208%2Fexport.png?alt=media)

2. 这将下载一个 *.zip* 文件，解压它。
3. 打开 **创作者中心**，进入 **场景** 部分。
4. 点击 **导入场景** 按钮，并选择你导出的项目文件夹路径。

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

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

你也可以编辑其下的文件 `/src` 文件夹，为你的场景添加代码行为。参见 [与代码结合使用](/creator/content-creator-zh/chang-jing-bian-ji-qi/shi-yong-dai-ma-kuo-zhan/overview.md) 了解如何编辑场景代码。

## 迁移纯代码项目

你可以将任何纯代码项目导入 Creator Hub。为此，

1. 打开 Creator Hub，进入 **场景** 部分。
2. 点击 **导入场景** 按钮，并选择你导出的项目文件夹路径。

![](https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-684f70250aae678dd8d6f868d02f7a739a51ae22%2Fimport-scene.png?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-0be6795f51a4b3256f2316be0347810e4fcb034b%2Fempty-project.png?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` 文件夹，并取消注释你需要的行。

你可能还想重写部分代码，使其不再创建新的实体，而是通过名称或标签引用现有实体，从而赋予它们行为。参见 [与代码结合使用](/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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.decentraland.org/creator/content-creator-zh/chang-jing-bian-ji-qi/kai-shi-shi-yong/migrate-from-web.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
