Unity Remote 是可下载的应用程序,旨在帮助进行 Android、iOS 和 tvOS 开发。从 Unity Editor 以播放模式运行项目时,该应用程序将与 Unity 连接。Editor 的可视输出将发送到设备的屏幕,而实时输入将发送回 Unity 中正在运行的项目。这样,您可以很好地了解您的游戏在目标设备上的真实视觉效果和处理方式,而又省去了针对每项测试进行完整构建的麻烦。
Unity Remote 替换了与早期版本一起使用的独立 iOS 和 Android Remote 应用程序。旧的 Remote 应用程序不再受支持。
旧版本的 Unity Remote 仍可用于旧版项目;有关这些版本的更多信息,请参阅旧版 Unity Remote 文档。
Unity Remote 目前支持 Android 设备(在 Windows 和 OS X 上通过 USB 连接)和 iOS 设备(iPhone、iPad、iPod touch 和 Apple TV,在 OS X 以及装有 iTunes 的 Windows 上通过 USB)。
正在运行的 Unity 项目的 Game 视图在设备屏幕上复现,但帧率降低。来自设备的以下输入数据也将流式传回 Editor:
请注意,Remote 应用程序只显示设备上的可视输出并从中获取输入。游戏的实际处理仍由桌面计算机上的 Editor 完成,因此其性能并不是构建后的应用程序的精确反映。
Unity Remote can be downloaded for free in the form of a Unity project that you build yourself, or as a pre-built app from the device’s app store:
下载应用程序后,请在设备上安装并运行它,并用 USB 线缆将设备连接到计算机。
To enable Unity to work with your device, open the Editor Settings in Unity (menu: Edit > Project Settings > Editor) and select the device to use from the Unity Remote section:
Click the Play button in the Editor to see your game appear on the device and in the Unity game window as Unity connects to the Remote app. While the game plays, input from the device (accelerometer, etc) is sent to your scripts as if they were running on the device itself.
Unity Remote doesn’t support multiple connected Android devices, and to resolve this, it will automatically pick the first device it finds. However, it is fine to have multiple iOS/tvOS devices and one Android device connected at the same time, since you can select which one to use from the Editor Settings (menu: Edit > Project Settings > Editor).
使用 Unity Remote 时,游戏实际上在 Editor 中运行,同时其可视内容串流到目标设备。由于 Editor 和设备之间的带宽有限,因此必须对串流内容进行大量压缩以便进行传输。这种压缩不可避免地会降低图像质量。
In the Unity Remote section of the Editor settings (menu: Edit > Project Settings > Editor) you can switch the compression method between JPEG and PNG, and also optionally downsize the resolution of the screen image. PNG compression is “lossless” (so the image quality doesn’t degrade) but uses more bandwidth than JPEG. A downsized image has lower bandwidth requirements than one at full resolution. By changing these settings, you can trade image accuracy off against framerate as necessary.
应注意,Unity Remote 的目的仅仅是快速适当检查游戏在设备上运行时的显示效果和感受。请确保偶尔进行完整的构建,并测试“真正的”应用程序。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.