> 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-sdk7/qi-ta/migrate-legacy-sdk6-scenes.md).

# 迁移旧版 SDK6 场景

使用 AI 助手将旧版 SDK6 场景迁移到 SDK7。

如果你有一个想要更新的旧版 SDK6 场景，可以借助 AI 助手将其自动迁移到 SDK7。 [Decentraland SDK Skills](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/ru-men/vibe-coding.md#install-skills-for-any-ai-agent) 包含专门的迁移工作流，AI 会按步骤执行，因此你无需手动转换代码。

本指南将带你了解完整的迁移流程。

## 1. 创建一个新的空白 SDK7 场景

从一个全新、空白的 SDK7 项目开始。AI 会将旧版代码和资源迁移到这个干净的项目结构中。

**选项 A — Creator Hub**

1. 打开 Creator Hub。
2. 选择 **场景** 选项卡，然后点击 **新建场景**.
3. 选择 **空场景** 模板。

**选项 B — 命令行**

在空文件夹中运行以下命令：

```bash
npx @dcl/sdk-commands init
```

此命令会在文件夹中创建 SDK7 项目的默认文件。

## 2. 安装 SDK Skills

SDK Skills 会教你的 AI 智能体如何使用 Decentraland SDK7，包括如何正确地将 SDK6 迁移到 SDK7。

你可以通过两种方式安装它们。

**选项 A — 让 AI 帮你安装**

在场景文件夹中打开 AI 助手，然后直接说：

> 安装 Decentraland SDK 技能。

AI 知道要运行什么命令，会帮你完成安装。

**选项 B — 通过命令行安装**

```bash
npx skills add decentraland/sdk-skills --all
```

此 `--all` 标志可安装所有可用技能。如果不添加此标志，系统会打开交互式选择器，供你选择要安装的技能。

有关可用技能及其工作方式的详细信息，请参阅 [使用 AI 进行氛围编程](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/ru-men/vibe-coding.md#install-skills-for-any-ai-agent).

## 3. 让 AI 迁移场景

将旧版 SDK6 项目文件放在 AI 可以读取的位置，例如放在计算机上的单独文件夹中，或放在公开的 GitHub 仓库中。

然后向 AI 提示：

> 将此 SDK6 场景迁移到 SDK7。

技能中包含完整的迁移指南，因此 AI 将会：

* 识别 SDK6 场景使用的入口点和组件。
* 将实体、组件和系统转换为对应的 SDK7 版本。
* 将 3D 模型、音频和其他资源移至新项目中。
* 更新 `scene.json` 和项目配置。
* 将已弃用的 API 替换为 SDK7 中对应的当前 API。

## 4. 测试并迭代

迁移完成后，预览场景并完整运行一遍。

* 在 Creator Hub 中，点击 **播放**.
* 在命令行中运行 `npm run start`.

测试时，请留意以下方面：

* 视觉问题——模型缺失、位置或缩放比例错误、材质损坏。
* 交互问题——点击无响应、触发器未激活、对话框未显示。
* 多人游戏或网络问题（如果场景使用了这些功能）。
* 预览窗口中的控制台错误。

发现错误时，用通俗的语言向 AI 描述：

> 桌上的红色按钮不再能打开门了。它以前会播放声音，并让门旋转 90 度。

AI 可以利用相关技能（交互、动画、音频等）逐一修复问题。不断迭代，直到场景的行为与原始场景一致。

{% hint style="info" %}
**💡 提示**：一次只修复一个错误，并在每次修改后预览。小幅修改更容易发现回归问题。
{% endhint %}

## 后续步骤

* [使用 AI 进行氛围编程](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/ru-men/vibe-coding.md) — 使用 AI 助手和 SDK Skills 的完整参考指南。
* [SDK 快速入门](https://docs.decentraland.org/creator/content-creator-zh/chang-jing-sdk7/ru-men/sdk-101.md) — 学习 SDK7 基础知识，以便检查和完善迁移后的代码。


---

# 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-sdk7/qi-ta/migrate-legacy-sdk6-scenes.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.
