> 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/wei-yi-dong-duan-gou-jian/kai-fa/preview-on-mobile.md).

# 在移动设备上预览

从 Creator Hub 或 CLI 在真实移动设备上预览你的场景。

你可以直接通过 Creator Hub 或命令行，在 Decentraland 移动应用中预览你的场景。这是确认你的 UI、输入处理和性能在真实设备上是否表现良好的唯一可靠方式。

## 前提条件

* 手机上安装了 Decentraland 移动应用——请参见 [下载链接](/creator/content-creator-zh/wei-yi-dong-duan-gou-jian/yi-dong-ke-hu-duan/overview.md#get-the-mobile-app).
* 手机和你的开发机器必须处于 **同一个局域网** （Wi-Fi）。预览内容由你的计算机提供；二维码会链接到局域网 URL。

## 选项 A——通过 Creator Hub

1. 在 Creator Hub 中打开你的场景。
2. 点击按钮旁边的下拉菜单 **预览** 并选择 **在移动设备上显示二维码**.
3. 用手机摄像头扫描显示的二维码。链接会打开 Decentraland 移动应用并加载你的场景预览。

<figure><img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-716e6ff7589c05f9ea2c6d87eee884b5c0c230c4%2Fmobile-preview-creator-hub.png?alt=media" alt="Creator Hub preview dropdown with the Show QR Code for Mobile option"><figcaption><p>Creator Hub 预览下拉菜单中的“为移动设备显示二维码”选项。</p></figcaption></figure>

## 选项 B——通过命令行

在你的场景项目根目录下，运行：

```bash
npm run start -- --mobile
```

CLI 会在终端中打印出一个二维码，指向你场景的局域网 URL。用手机扫描它，即可在 Decentraland 移动应用中加载场景。

<figure><img src="https://2460066822-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-19562a6b332d4bb5254d6f2d9b92d923b3ce7069%2Fmobile-preview-cli-qr.png?alt=media" alt="QR code printed by the Decentraland CLI for mobile preview"><figcaption><p>由 <code>npm run start -- --mobile</code>打印出的二维码。用手机扫描它，即可在 Decentraland 移动应用中打开场景。</p></figcaption></figure>

{% hint style="info" %}
**💡 提示**：当你传入 `--mobile`时，桌面版浏览器也不会同时启动。如果你想同时测试两者，请在 `npm run start` 一个终端中运行桌面版的 `npm run start -- --mobile` ，另一个终端中运行移动版的。
{% endhint %}

## 热重载

与桌面预览一样，当你更改场景文件时，移动预览也会自动重新加载。你不需要在每次编辑后重新扫描二维码。

## 故障排除

* **二维码无法打开应用** ——请确保已安装 Decentraland 应用，并且你已在该设备上至少打开过一次。
* **手机无法连接到预览服务器** ——请确认手机和开发机器处于同一个 Wi-Fi 网络中。某些企业网络会隔离客户端；如果是这种情况，请使用个人热点或其他网络。
* **场景在手机上加载了，但看起来与桌面端不同** ——这是预期内的。请借此时机验证你的 [安全区域](/creator/content-creator-zh/wei-yi-dong-duan-gou-jian/kai-fa/safe-area.md), [UI 尺寸](/creator/content-creator-zh/wei-yi-dong-duan-gou-jian/kai-fa/ui-best-practices.md#sizing)，以及 [输入绑定](/creator/content-creator-zh/wei-yi-dong-duan-gou-jian/kai-fa/input-on-mobile.md).

## 相关

* [预览你的场景](/creator/content-creator-zh/chang-jing-sdk7/ru-men/preview-scene.md)
* [使用 CLI](/creator/content-creator-zh/chang-jing-sdk7/ru-men/using-the-cli.md)
* [让你的内容在移动端 Discover 中获得推荐](/creator/content-creator-zh/wei-yi-dong-duan-gou-jian/fa-bu/get-featured.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/wei-yi-dong-duan-gou-jian/kai-fa/preview-on-mobile.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.
