> 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 技能](/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 技能

SDK 技能会教你的 AI 代理如何使用 Decentraland SDK7，包括如何执行正确的 SDK6 → SDK7 迁移。

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

**选项 A — 让 AI 为你安装它们**

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

> 安装 Decentraland SDK 技能。

AI 知道这条命令，并会为你安装它们。

**选项 B — 从命令行安装**

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

该 `--all` 标志会安装所有可用的技能。如果你省略它，将打开一个交互式选择器，让你选择要安装哪些技能。

有关可用技能以及它们如何工作的更多详情，请参见 [借助 AI 进行氛围编程](/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` 以及项目配置。
* 用当前的 SDK7 对应项替换已弃用的 API。

## 4. 测试并迭代

迁移步骤完成后，预览场景并完整体验一遍。

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

测试时，请留意：

* 视觉问题——缺失的模型、错误的位置或缩放、损坏的材质。
* 交互问题——点击没有触发、触发器没有激活、对话框没有出现。
* 如果你的场景使用了多人或联网功能，也要留意相关问题。
* 预览窗口中的控制台错误。

当你发现 bug 时，用通俗易懂的语言把它描述给 AI：

> 桌子上的红色按钮现在无法再打开门了。以前它会播放音效并将门旋转 90 度。

AI 可以利用周围的技能（交互、动画、音频等）逐个修复问题。不断迭代，直到场景表现与原版一致。

{% hint style="info" %}
**💡 提示**—— 与 AI 助手和 SDK 技能协作的完整参考。
{% endhint %}

## 下一步

* [借助 AI 进行氛围编程](/creator/content-creator-zh/chang-jing-sdk7/ru-men/vibe-coding.md) —— 学习 SDK7 基础知识，以便审查并优化迁移后的代码。
* [SDK 快速入门](/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.
