Version: 2017.2
Upgrading to 64 bit iOS
iOS 脚本

Unity Remote

Unity Remote is a downloadable app designed to help with Android, iOS and tvOS development. The app connects with Unity while you are running your project in Play Mode from the editor. The visual output from the editor is sent to the device’s screen, and the live inputs are sent back to the running project in Unity. This allows you to get a good impression of how your game really looks and handles on the target device, without the hassle of a full build for each test.

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)。

The Game View of the running Unity project is duplicated on the device screen, but at a reduced framerate. The following input data from the device is also streamed back to the editor:

  • 触摸和触笔输入
  • 加速度计
  • 陀螺仪
  • 设备相机流
  • 指南针
  • GPS
  • 游戏杆名称和输入

Note that the Remote app simply shows the visual output on the device and takes input from it. The game’s actual processing is still done by the Unity editor on the desktop machine - so its performance is not a perfect reflection of the built app.

获取和使用 Unity Remote

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 配合使用

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 中运行游戏时,图形质量非常差

When you use Unity Remote the game actually runs in the Unity editor, while its visual content is streamed to the target device. Since the bandwidth between editor and device is limited, the stream must be compressed heavily for transmission. This compression inevitably reduces the image quality.

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 的目的仅仅是快速适当检查游戏在设备上运行时的显示效果和感受。请确保偶尔进行完整的构建,并测试“真正的”应用程序。

Upgrading to 64 bit iOS
iOS 脚本