Search Unity

Speed up mobile iteration with the new Device Simulator

, September 27, 2019

When you’re creating content for mobile devices, you have to test and tweak your project to make sure it works with a huge variety of device characteristics. Even if you have access to all of your targeted hardware, getting a sense of how your content will look on each of these devices is time-consuming.

That’s why we created a new Device Simulator, which enables you to preview the behaviors and physical characteristics of different devices. This allows game code run in the Editor to match what runs on a real device much more closely. You can now preview specific resolutions and notch/cutout layouts in the Game View, as well as preview device-specific customizations such as selected quality settings based on device info like RAM, chipset, etc.

Overview of the Device Simulator

The Device Simulator includes the following features:

  • An extended Game View, which allows you to turn Simulation Mode on and off and to select devices
  • An extensible device database that stores the device and phone configurations and characteristics that will drive API shims’ return values
  • API shims that return device-specific API’s results (screen resolution, device model, orientation, etc.) when used in Editor Play Mode
  • You can watch a demo of the Device Simulator in action.

List of simulated devices

The Device Simulator includes a list of predefined phones that are in the package by default (in the com.unity.device-simulator/com.unity.device-simulator folder). Device definitions are stored in JSON files, and we will expand this list regularly through package updates. We will also offer a mechanism for adding custom device definitions to a project so it can be shared easily and checked-in in source control.

Simulation scenarios

The two main classes that are managed by the Device Simulator are UnityEngine.Screen and UnityEngine.SystemInfo, and returned values are fed by the device definition JSON file.

This feature enables you to test in-Editor behavior that is specific to devices. For example, you can dynamically adjust your UI by calculating the size of your canvas to account for the notch on different phones.

Device Simulator showing SafeArea position and behavior to control Canvas position. 

The Devices Simulator is also extensible, allowing you to build your own simulation scenarios. You can use the extension point to bring Adaptive Performance to the Simulator. This feature lets you force (simulate) throttling events, then validate your code to adjust performance on the fly and ensure that it triggers properly. We will follow up soon with a dedicated blog post explaining how extensibility works.

Simulating an Adaptive Performance throttling event to test the performance adjustment logic (here, to reduce the number of spawned objects).

A Preview version of the Device Simulator is available for Unity 2019.3 (beta) now through the Package Manager. Please join us on the forum to ask questions or share your feedback. We’re eager to hear what you think!

30 replies on “Speed up mobile iteration with the new Device Simulator”

The author has written an excellent article. You made your point and not much to discuss. It’s like this universal truth that you can not argue with the truth is not universal, everything has its exception. Thanks for this information. tree care

This is great! thanks. Tried it out, but possibly found a bug, Screen.width and Screen.height report the simulated editor canvas size, instead of the device’s resolution. Normally those values are the actual device resolution.

Tried scaling view up to 100% to get around this, but the side bars don;t allow you to scroll to see the whole screen. can’t get camera view higher than about half way up the screen.
Looking forward to finished version… with will be a great help when finished.

I made a similar asset for previewing phones and tablets, that works for all Unity version from 5.0 to 2019.2.

It is called “Multi Device Preview & Gallery”.

You can preview more than 200 device presets and more than 50 full phone and tablet preview, including phones with notches. It also include popularity presets to target the popular phones of your target platforms. You can preview multiple devices at once in the gallery.

You can find the list of more 200 phone and tablet presets in the asset store page:

Currently we have shipped with two different Ipad Pro’s loaded but we will be adding more over the coming weeks to build a more rounded database.

Brilliant! It is not possible to have all the available devices, but this means we can get away with fewer than before. I still think the biggest, smallest, and least performant are needed. But at least we don’t need every aspect ratio and notch type now, which is getting to be a problem with the variety available.

Love this!
Seems to be API & CPU focused though… does this or will this address differences in graphics hardware, shader compatibility etc as well?

Great question. Currently we are only simulating SystemInfo and Screen, however we are investigating expanding this to also be able to override Graphics Capabilities & Shader keywords which would go another step to more closely replicate the visuals presented on a specific mobile device (TBD at this time). It’s important to note this wouldn’t be a full emulator nor are we able to emulate device specific performance.

Great news!

I was wondering will this system also simulate device performance ?
For example I found out that a 2d test scene was rendering at 60fps on Samsung S6 but only 7 to 9 fps on a Samsung J5.
Will this simulation be able to emulate this in a way that it would be possible to fine tune a scene for a given device taking into account a device hardware limitations ?

Unfortunately estimating performance on specific devices is not feasible. However this should certainly help you test different ‘quality tier’s’ that you can define and toggle to at runtime based on device models or chipsets.

Comments are closed.