Search Unity

New Device Simulator (preview)

Discussion in '2019.3 Beta' started by JC-Cimetiere, Sep 26, 2019.

  1. JC-Cimetiere

    JC-Cimetiere

    Unity Technologies

    Joined:
    May 8, 2014
    Posts:
    39
    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.

    upload_2019-9-26_11-39-19.png

    A Preview version of the Device Simulator is available for Unity 2019.3 (beta) now through the Package Manager.

    Please ask questions or share your feedback. We’re eager to hear what you think!
    JC
     
  2. Foriero

    Foriero

    Joined:
    Jan 24, 2012
    Posts:
    467
    Very nice. Congrats. :)
     
  3. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,829
    Very important feature, this is going to save lots of time and help avoid surprises!

    What about DPI simulation, does this package support it?
     
  4. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    868
    +1
     
  5. NiallSoe

    NiallSoe

    Joined:
    Jan 30, 2018
    Posts:
    5
    Looks like a great feature! We are restricted to LTS releases though, so can this be back-ported to 2018.4 LTS please? It would save a huge amount of time for us!
     
  6. GilG

    GilG

    Joined:
    Jan 30, 2017
    Posts:
    2
    Hello @JC-Cimetiere this looks like a really cool feature. I installed 2019.3 and can't find it in the package manager.
    Also the link to the documentation has been removed.

    Is this package really available today ?
     
  7. ScottF

    ScottF

    Director of Development, Mobile Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    90
    Unfortunately we cannot in this case. To build this feature we had to make some changes to some core Editor code which allows us to inject a mocking layer. This is then used by the Device Simulator package. To ensure we maintain the stability of LTS builds we do not backport changes of this scale. On the plus side 2019.4 will be here before you know it :)
     
    Brogan89 and Peter77 like this.
  8. ScottF

    ScottF

    Director of Development, Mobile Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    90
    Make sure you have turned on 'Preview Packages' by pressing the Advanced menu button, see screenshot below:
    Screen Shot 2019-09-27 at 1.36.01 PM.png
     
    GilG likes this.
  9. QMagic

    QMagic

    Joined:
    Aug 23, 2019
    Posts:
    2
  10. ScottF

    ScottF

    Director of Development, Mobile Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    90
    The simulator will accurately report the screen DPI so for example things like Unity Canvas Scalar will properly reflect the DPI and any user gamecode should also properly be reflected.

    Seems to be working now, at least it resolved for me to: https://docs.unity3d.com/Packages/com.unity.device-simulator@1.0/manual/index.html
     
  11. danielgsantana

    danielgsantana

    Joined:
    Mar 11, 2015
    Posts:
    12
    Hi,
    Does Device Simulator supports Linear workflow? Right now it seems it doesn't apply the gamma to the output we seen in the simulator.

    Cheers,
    Daniel
     
  12. ChaoticBox

    ChaoticBox

    Joined:
    Mar 6, 2015
    Posts:
    6
    Looks great! It'd be nice to have some preset scaling options similar to Xcode's simulator (pixel-accurate, point-accurate, physical size). I know physical size can be tricky on some platforms where the editor DPI isn't known/accurate, but a manual override for that value would be fine.
     
  13. QMagic

    QMagic

    Joined:
    Aug 23, 2019
    Posts:
    2
    @ScottF I still get a 404 error. I tried in private browsing, same thing.
    Not a big deal, since the package is available through the editor manager.
     
  14. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    126
    This looks great.

    For those who are working on a version lower than 2019.3, or people who want a larger quantity of devices with their picutres, we 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
     
    HonorableDaniel likes this.
  15. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,829
    How about simulating a specific device’s DPI?
     
  16. CraigWW

    CraigWW

    Joined:
    Jun 10, 2019
    Posts:
    1
    it would be great to be able to simulator multiple screens (multiple camera views) easily
     
  17. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    389
    Awesome package, will it also be possible to take screenshots?
    Will it eventually also be able to simulate Google VR overlay?

    Would be nice to have an in editor way of making screenshots Automated so that if for instance you have a template app you can create screenshots for all resolutions required by Apple without having the device in-house.

    It would also make it possible to do runtime testing then by generating screenshots of an automated process and compare them to check for differences. So that when you do an update for UI code or UI package or Unity Engine update that you can easily check if all is still working as expected or that it requires a fix in code.
     
    Vincent-Zhang likes this.
  18. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    126
    You can do that with both my assets, Ultimate Screenshot Creator or Multi Device Preview
     
  19. JC-Cimetiere

    JC-Cimetiere

    Unity Technologies

    Joined:
    May 8, 2014
    Posts:
    39
  20. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    389
    Yes I've seen your self advertising post. But I'm not looking forward to purchase and use more packages from the asset store. No offence. I just have multiple terrible experiences with the Unity Asset Store, that I want to refrain as much as possible from purchasing and using them.

    Hence I ask if there is going to be functionality from Unity's own device simulation package for this. Like is the Device Simulator compatible with
    ScreenCapture.CaptureScreenshot
    . If it is then possible to overlay it with a Google VR overlay then it would be perfect.
     
  21. fabriciomoreira19

    fabriciomoreira19

    Joined:
    Aug 6, 2018
    Posts:
    2
    Mouse input on the device simulator is not working with the new input system
     
    WolveX likes this.
  22. ArisDG

    ArisDG

    Joined:
    Apr 5, 2016
    Posts:
    2
    Thanks !!! This is a first step to improve our mobile projects.
     
  23. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    126
    I understand your desire to focus on Unity included features instead of purchasing assets.
    Note however that not all publishers are terrible, most of us try to provide good assets with an efficient customer support.
     
    Last edited: Sep 29, 2019
  24. ScottF

    ScottF

    Director of Development, Mobile Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    90
    This is on the roadmap, including ability to simulate newer use cases like fold/unfold on those newer foldable displays. This is not our highest priority (we want to build out database of more prevalent devices first) but is coming!

    Heard this request a few times at Unite. Will discuss internally the best way to do this. For example we could make a button & API thats specific to simulator or perhaps as you mentioned it working directly with the existing CaptureScreenshot API might be best. I didn't test it yet but *fairly* certain if you call that API in simulator today you would get the entire editor window.. Thanks for the feedback!
     
  25. GilG

    GilG

    Joined:
    Jan 30, 2017
    Posts:
    2
    Thanks :)
     
  26. wilmer_lin

    wilmer_lin

    Joined:
    Nov 7, 2014
    Posts:
    3
    How do we create a new device definition? It doesn't seem like you can just copy/paste a new JSON file in the DeviceDefinitions folder...
     
  27. shaharbar2

    shaharbar2

    Joined:
    Jan 21, 2014
    Posts:
    1
    Quick feedback after using the feature today -

    We develop for portrait mode, when developing in "game" mode and switching to "Simulator" mode the game view is super tiny because of the Specs tab
    It would be great if I could hide the tab, that way wouldn't need to enlarge the Simulator view every time I need to change to simulator mode

    Also the colors are different in the Simulator view, is that intended?
     
    Last edited: Oct 1, 2019
    createtheimaginable likes this.
  28. developerJoinpad

    developerJoinpad

    Joined:
    Oct 12, 2016
    Posts:
    1
    Hi.
    Is it possible to use ARFoundation capabilities in the Device Simulator?
     
  29. xzodia

    xzodia

    Joined:
    Jan 24, 2013
    Posts:
    26
    I just tried out preview 1.1 on OSX, Unity 2019.3.0b5, and the simulator view was inverted, it looked like it was scaled (-x, -y)
     
  30. lorddesu

    lorddesu

    Joined:
    Aug 20, 2014
    Posts:
    25
    upload_2019-10-4_22-16-48.png
    Whats wrong? I just want previews to be the same.
     
  31. gabriel81mi

    gabriel81mi

    Joined:
    May 19, 2015
    Posts:
    6
    Why I don't have it device simulator? I turn on preview package but nothing appear
     
  32. gabriel81mi

    gabriel81mi

    Joined:
    May 19, 2015
    Posts:
    6
    I understood, my unity version it is old for this package
     
  33. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    350
    Device Request: Nintendo Switch
     
    Jes28 likes this.
  34. AnisimovArthur

    AnisimovArthur

    Joined:
    Mar 4, 2013
    Posts:
    1
    Hi.
    Thank you for the awesome tool.

    It would be great if you could minimize the window in such a way that only a device would be visible.
    Something like that:

    upload_2019-10-8_20-32-47.png


    Thank you!
     
    Vincent-Zhang and Jes28 like this.
  35. JC-Cimetiere

    JC-Cimetiere

    Unity Technologies

    Joined:
    May 8, 2014
    Posts:
    39
    What would be the most useful to simulate beyond resolutions?
    We were thinking about simulating things like docking/undocking events.

    Any suggestions?
     
  36. JC-Cimetiere

    JC-Cimetiere

    Unity Technologies

    Joined:
    May 8, 2014
    Posts:
    39
    That's a fair request, hiding options would make sense. We will add to the backlog.
    thanks
     
    AnisimovArthur likes this.
  37. JC-Cimetiere

    JC-Cimetiere

    Unity Technologies

    Joined:
    May 8, 2014
    Posts:
    39
    having both the simulator & game view at the same time might be the issue here. The Simulator is a "special" instance of the game view, so Unity cannot render both, it will render only one at a time. We are looking at making that more obvious.
    try closing the game view.
     
  38. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,120
    The actual performance/memory/etc characteristics of that particular hardware. Most likely not feasible, but you asked :)
     
    JoNax97 likes this.
  39. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    868
    DPI/PPI, im not sure if thats handled
     
  40. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,120
    Make the return value of
    Application.internetReachability
    configurable in the simulator. This would allow me to test if my game detects internet reachability changes correctly and properly updates its UI.
     
    jGate99 and Jes28 like this.
  41. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,120
    Unstable and slow frame-rate simulation.

    We have to support rather old mobile devices where the game is to be expected to run at 20fps from time and is overly stuttery, eg 200ms spikes when UI opens etc. This bad performance obviously never happens in the editor. So we had the problem that several "delta time" issues only occurred on the device.

    We then implemented "random sleeps" on the main thread to poorly simulate this behavior in the editor. This helped us to detect various frame-rate depended issues in the editor, where we had to run on the device previously.

    Our S***ty frame-rate simulation look like this:
    Code (CSharp):
    1. var threadSleepMin = Commandline.GetInt("-ThreadSleepMin", 0);
    2. var threadSleepMax = Commandline.GetInt("-ThreadSleepMax", 0);
    3. if (threadSleepMin > 0 && threadSleepMax > 0)
    4. {
    5.     var threadSleep = UnityEngine.Random.Range(threadSleepMin, threadSleepMax);
    6.     System.Threading.Thread.Sleep(threadSleep);
    7. }
     
    Jes28 likes this.
  42. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,120
    Make
    Application.systemLanguage
    configurable in the Simulator. So I can properly test if my game picks up the correct system language on the first start.
     
    jGate99 likes this.
  43. Jes28

    Jes28

    Joined:
    Sep 3, 2012
    Posts:
    395
    Add simulation of device behavior like:
    - switch to another app and go back
    - press of power button to make device sleep and go back
     
    Peter77 and jGate99 like this.
  44. Vincent-Zhang

    Vincent-Zhang

    Unity Technologies

    Joined:
    Jan 23, 2013
    Posts:
    92
    With the latest version 1.2.0-preview which supports setting a customized device folder, you can copy/paste the existing json files to any folder and modify as you want. You can find the setting at Preferences->Device Simulator.
     
  45. Vincent-Zhang

    Vincent-Zhang

    Unity Technologies

    Joined:
    Jan 23, 2013
    Posts:
    92
    Are you using URP or HDRP? We have a bug with the shader we used in device simulator, we're working on a fix.
     
  46. Vincent-Zhang

    Vincent-Zhang

    Unity Technologies

    Joined:
    Jan 23, 2013
    Posts:
    92
    What kind of DPI simulation are you talking about? In this package, we considered the Fixed DPI option in player settings, you can set the dpi with this option on. Let me know if you're talking about something else.
     
  47. Vincent-Zhang

    Vincent-Zhang

    Unity Technologies

    Joined:
    Jan 23, 2013
    Posts:
    92
    Thanks. We discussed the physical size scale while developing, will have it in discussion again. :)
     
    ChaoticBox likes this.
  48. Vincent-Zhang

    Vincent-Zhang

    Unity Technologies

    Joined:
    Jan 23, 2013
    Posts:
    92
    Bug report?
     
  49. HonorableDaniel

    HonorableDaniel

    Joined:
    Feb 28, 2007
    Posts:
    2,829
    Do you have a place to enter the PPI as shown in the screenshot below?
    Screen Shot 2019-10-14 at 9.39.19 AM.png
     
    jGate99 likes this.
  50. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    868
    Same thing im requesting
    This will show our ugui different based on these devices with different ppis.