Unity Remote 是可下载的应用程序,旨在帮助进行 Android、iOS 和 tvOS 开发。从 Unity Editor 以播放模式运行项目时,该应用程序将与 Unity 连接。Editor 的可视输出将发送到设备的屏幕,而实时输入将发送回 Unity 中正在运行的项目。这样,您可以很好地了解您的游戏在目标设备上的真实视觉效果和处理方式,而又省去了针对每项测试进行完整构建的麻烦。
注意:要使 Unity Remote 正常工作,必须在开发计算机上安装 Android SDK。
Unity Remote 替换了与早期版本一起使用的独立 iOS 和 Android Remote 应用程序。旧的 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 项目的形式免费下载 Unity Remote,也可以从设备的应用商店下载预构建的应用程序:
下载应用程序后,请在设备上安装并运行它,并用 USB 线缆将设备连接到计算机。
要使 Unity 能够与您的设备一起使用,请在 Unity 中打开 Editor 设置(菜单:__Edit__ > Project Settings__,然后选择 Editor__ 类别),并从 Unity Remote 部分中选择要使用的设备:
注意:要指定 Android SDK 的位置,请选择 Edit > Preferences (Windows) 或 Unity > Preferences (Mac)。
单击 Editor 中的 Play 按钮可以看到您的游戏出现在设备上以及 Unity 游戏窗口中(当 Unity 连接到 Remote 应用程序时)。当游戏播放时,来自设备(加速度计等)的输入会发送到脚本,就好像它们在设备本身上运行一样。
Unity Remote 不支持连接多个 Android 设备,为解决此问题,它会自动选择找到的第一个设备。但是,可以同时连接多个 iOS/tvOS 设备和一个 Android 设备,因为可以从上面提到的 Editor 设置(菜单:__Edit > Project Settings__,然后选择 Editor 类别)中选择要使用的设备。
使用 Unity Remote 时,游戏实际上在 Editor 中运行,同时其可视内容串流到目标设备。由于 Editor 和设备之间的带宽有限,因此必须对串流内容进行大量压缩以便进行传输。这种压缩不可避免地会降低图像质量。
在 Editor 窗口(菜单:__Edit > Project Settings__,然后选择 Editor 类别)的 Unity Remote 部分,可以在 JPEG 和 PNG 之间切换压缩方法。PNG 压缩是“无损”压缩(因此图像质量不会降低),但使用的带宽比 JPEG 多。缩小尺寸的图像的带宽要求比全分辨率图像的带宽要求更低。通过更改这些设置,可以根据需要在图像精度与帧率之间进行折衷。使用较低分辨率时,请注意 Unity Remote 会缩小图像尺寸以获得更好的性能。
应注意,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.