Search Unity

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 코멘트

코멘트 구독

leave_a_reply to toto답글을 취소하려면 여기를 누르십시오.

사용할 수 있는 HTML 태그 및 속성: <a href=""> <b> <code> <pre>

  1. A bit late to the party, but is there anything planned regarding gesture simulation?

  2. 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

  3. Only one iphone with a notch is supported? I hope you guys update the device list some time soon.

  4. 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.

    1. 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.

  5. In my opinion something like this is absolutely essential for proper app development.

  6. thanks, device simulator really helpful

  7. impressive if it works

  8. Fabiano Alves de Sousa

    9월 28, 2019 12:24 오전 응답

    i love u unity! <3

  9. thanks great device simulator really helpful

  10. 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: https://assetstore.unity.com/packages/tools/utilities/multi-device-preview-gallery-82015

    1. Hi, you have a really cool asset/tool package.
      We will publish soon more details on own to extend the device simulator, it might be a good opportunity to have your features even more integrated to Unity Editor.
      JC

      1. Hello,
        Thanks for your message.
        This sounds very interesting, keep me updated!

  11. Would be really useful if you also had a couple of tablet devices.

    1. 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.

  12. After 10 and more years of mobile developing, about time!

  13. 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.

  14. Bravo. I applaud while standing!

  15. Finally , This is awesome .

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

    1. Yea! That i was asking as well but you put it in better words. ;-)

    2. 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.

  17. Finally the time saviour is here… Great addition to 2019.3

  18. Mustafa Güray Şenova

    9월 27, 2019 10:03 오전 응답

    Good news!

  19. This really needs to be back-ported to 2018.4 LTS.

  20. Absolutely brilliant!!!!

  21. Arnold Wittenberg

    9월 27, 2019 9:47 오전 응답

    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 ?

    1. 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.

  22. This is awesome :)