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!
Paul
十月 31, 2019 8:11 上午A bit late to the party, but is there anything planned regarding gesture simulation?
fredluis
十月 17, 2019 6:58 上午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
Wilczarz
十月 14, 2019 4:37 下午Only one iphone with a notch is supported? I hope you guys update the device list some time soon.
Jon
十月 11, 2019 2:50 上午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.
Jon
十月 11, 2019 2:59 上午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.
Daniel
九月 28, 2019 9:03 上午In my opinion something like this is absolutely essential for proper app development.
Devang Agrawal
九月 28, 2019 6:11 上午thanks, device simulator really helpful
toto
九月 28, 2019 3:40 上午impressive if it works
Fabiano Alves de Sousa
九月 28, 2019 12:24 上午i love u unity! <3
kerry
九月 27, 2019 6:45 下午thanks great device simulator really helpful
Wild Mage Games
九月 27, 2019 6:19 下午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
JC Cimetiere
九月 28, 2019 10:32 上午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
Wild Mage Games
九月 29, 2019 8:51 下午Hello,
Thanks for your message.
This sounds very interesting, keep me updated!
Gareth
九月 27, 2019 5:11 下午Would be really useful if you also had a couple of tablet devices.
Scott Flynn
九月 27, 2019 5:30 下午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.
Diego
九月 27, 2019 2:10 下午After 10 and more years of mobile developing, about time!
Andy
九月 27, 2019 2:05 下午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.
Ilya
九月 27, 2019 1:57 下午Bravo. I applaud while standing!
Musta
九月 27, 2019 1:00 下午Finally , This is awesome .
adrian
九月 27, 2019 11:26 上午Good work
Wendelin REICH
九月 27, 2019 10:12 上午Love this!
Seems to be API & CPU focused though… does this or will this address differences in graphics hardware, shader compatibility etc as well?
Arnold Wittenberg
九月 27, 2019 10:19 上午Yea! That i was asking as well but you put it in better words. ;-)
Scott Flynn
九月 27, 2019 1:10 下午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.
Niraj Vishwakarma
九月 27, 2019 10:11 上午Finally the time saviour is here… Great addition to 2019.3
Mustafa Güray Şenova
九月 27, 2019 10:03 上午Good news!
Ferhat Sener
九月 27, 2019 10:02 上午This really needs to be back-ported to 2018.4 LTS.
Lasse Bay
九月 27, 2019 9:56 上午Absolutely brilliant!!!!
Arnold Wittenberg
九月 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 ?
Scott Flynn
九月 27, 2019 1:13 下午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.
Isaac Surfraz
九月 27, 2019 9:34 上午This is awesome :)