Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

⭐ UNIVERSAL DEVICE PREVIEW ⭐ - get a real preview of your game

Discussion in 'Assets and Asset Store' started by WildMageGames, Mar 17, 2017.

  1. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Call for user feedback for an usability update

    I am currently working on an usability update, to improve the interface and make the asset more user friendly, especially regarding the device preset selection and management. If you have any request or feedback please answer this message or send us an email, so we can improve the asset as you need it :)
     
  2. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Universal Device Preview 1.9 is out, with tons of new features !

    1.9.0 - 09/07/2020
    • (New feature) New device presets selector, more intuitive and with a lot of filters.
    • (New feature) You can now add tags to presets.
    • (New feature) Easy one-click custom collections creation from device list.
    • (New feature) Landscape right simulation.
    • (New feature) Quick devices selection in the gallery window.
    • Unity 2019.4 support.
    • Reworked folder hierarchy to facilitate adding assembly files.
    • The SafeArea component is now compatible with the Unity DeviceSimulator package.
    • (Fix) Init gameview resolutions on load.
    • (Fix) Preview with scale < 1.
    • New devices with image:
      • iPhone SE (2020)
    • New devices presets:
      • Samsung A10
      • Samsung A40
      • Samsung A50
    UPDATE GUIDE
    1. Backup your custom presets, custom collections, custom prefabs, ScreenshotWindowConfig.asset and UniversalDevicePreviewConfig.asset configuration files.
    2. (Recommended) remove the folder Asset/AlmostEngine.
    3. Import the package.
    4. Restore your backed config files.

    selector.png
    New device selector, with filters, tags, easy collection creation

    quickselect.png
    Quick device selection in the Gallery Window​
     
    Timmy-Hsu likes this.
  3. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    I guess we can have several DeviceCustomBorder scripts at the same time right? because we might want one group of custom anchors for a group of devices and a different one for some others.

    PS: it would be also nice to be able to add our own descriptions or tags to the Device name List so we can differentiate the manufacture model name from the commercial one instantly :p
    Thanks!!
     
  4. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Hello,

    Yes, you can add several DeviceCustomBorder, as long as each device is only listed in one of them.
    For each DeviceCustomBorder you have to carefully list the "simulation name" for instance "iphone 11 pro" and the manufacturer name for instance "iphone12,1".

    This script could indeed be more user friendly, can you specify your needs and give me some feedback so I can improve it ?
     
  5. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    simultation name and manufacturer name? I have just found 1 entry that requires the manufacturer name, I'm using v1.9.0


     
  6. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    The "device names" list must contains both the name of the device in the simulation and the manufacturer name.

    In the default example "iPhone X" will detect all iPhones X versions (X,XR, XS, XSMAX ...) and "iPhone10,3 iPhone10,6 iPhone11,2, iPhone11,4, iPhone11,6, iPhone11,8" are all the related manufacturer names. And "iPhone 11" will work for all iPhone 11 phones, and "iPhone12,..." are the manufacturer names.

    By telling this I see that there may be an issue if you want to detect only the iPhone X and not the iPhone XR. Do not hesitate to detail me what kind of usage you would want to make this feature easier to use.
     
  7. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    Ahhh I get it now, so the entry iPhoneX is just informative for that set it that correct? I mean, internally the script will look for a factory model name called iPhoneX but will ignore it. It will just detect the next ones.

    Well actually is not barely an issue since the measurements for both models are the same, but in case I would want to separate them I would just need to add another Device Custom Border component, set the borders for the XR, add the manufacturer name of the XR int it and remove it from the current one, wouldn't that work?

    Thanks!
     
  8. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Yes it would work in build, but in editor the "iphone XR" would be detected for both cases, so to work properly the component containing XR must be placed after the one with "iphone X" regarding to the execution order of the scripts.
     
    pistoleta likes this.
  9. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    990
    Hi I saved a new collection now how do I apply it?

    Edit: I figured it out - I had to change the category under search for presets
     
    Last edited: Aug 31, 2020
    WildMageGames likes this.
  10. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    Could you add device for Sony
    Xperia 1 II
    The device resolution is 3840 x 1644, and Ratio is 21:9
    Thank you.
     
  11. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Hello,

    I noted the device to be added in the next update.
    Are you just looking for a new preset, or also adding the device picture ?

    Meanwhile, do you need help to create your own custom device of the Sony Xperia 1 ?
    In the DeviceSelector, create a new empty preset using the "+" button, then set the name and resolution, then click on "export custom presets". The Xperia should now be available as a preset.

    Do not hesitate if you have any question.
     
    Timmy-Hsu likes this.
  12. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    When preview iPhoneX in unity,
    The fullscreen UI use the savearea script will Y has 1 pixel issue.
    Don'y known why.

    Snipaste_2020-10-28_18-05-40.png
     
  13. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Thanks for pointing this, I will look what I can do to solve it as soon as possible.
     
  14. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    205
    I experience a conflict in namespaces when importing the plugin. I had tried the latest version in an empty project on Unity 2019.4.12f1 and all was fine.

    I looked into Assets (search adn filter) and couldn't find anything that was like a custom script related to the safe area. Do you have any suggestion as to how I could proceed to find the culprit?

    ^^^ SOLVED ^^^
    Oops.
    When I imported your plugin there were two folders displayed at the root of the import window, the other being a free safe area plugin. It was strange but I presumed you needed both. I just realized your plugin had nothing to do with it. I removed the other one and it's all clear now.

    Great plugin btw!
     
    Last edited: Nov 26, 2020
    WildMageGames likes this.
  15. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    205
    Is the list of devices being updated from some kind of server database?
    Maybe you could use robots to collect data from certain websites, or perhaps even develop a partnership with one of them (so, say, a banner to their website would be added to your plugin)?
     
    WildMageGames likes this.
  16. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    I update the presets by hand by looking at new releases and popular phones, and the list is updated at each asset update. This is a good suggestion. Can you tell me more about what you expectation regarding the quantity and type of devices presets ? You would like more presets, more popular presets, almost all devices possibles ?
     
  17. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    universal_large-sale.png

    The asset is on SALE at 50% OFF until December 4th. Do not miss it!
     
  18. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    422
    Hi, What about Internet Access simulation like in "Device Simulator" package by Unity? Are you planning this feature?
     
  19. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    205
    There are some major mobile phone websites that have full lists of phones.
    https://www.devicespecifications.com
    https://www.gsmarena.com
    https://phonesdata.com
    https://www.mobilephonesspecs.com
    http://phonedb.net
    etc.
    Some of these websites even have a "popularity" filter.
    They also have all pictures.

    There's a filtering option in your plugin with the popularity category too. Unfortunately it seems blocked at 2019 Q2 and there's nothing more recent in it.
    Adding all of them by hand must take too much time, especially with the new Chinese companies releasing their new devices.
    Automatisation would facilitate things. Lists would be hosted on github or bitbucket and regularly updated.
    Perhaps also the plugin could suggest categories of preset to download from the git repository instead of hosting it all by default inside the project and having all presets loaded at once?
     
  20. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    205
    Also, save as collection does not provide a field for a name. Am I missing something?
    Besides, the crosses indicating if safe area and/or image data are provided are hardly visible.
     
  21. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    Hello there, I was wondering if we cannot preview our different devices with different CanvasScaler values.
    For all the mobile resolutions we use a match value in the canvas scaler but for tablets we want to use a different one because the buttons look too big.

    But if we do this by code we lose the real view in the preview. Is there any way to add the canvas scaler value to the preview? or is there another way to do what we are trying to do without using the canvas scaler?

    Also, in order to adapt my UI I've made a script that depending on the device width sets an horizontalLayoutGroup childForceExpand = true / false .

    But obviously I cannot see this change in the asset gallery because this script just runs in runtime, is there any way I could apply it for the DevicePreview ?

    Thanks a lot
     
    Last edited: Nov 30, 2020
  22. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    I just found the preview events in the documentation.
    With them I can set the different views and get the customized previews:

    I just have one question remaining, the asset has this useful events to subscribe but unity lacks of them. These ones are just called when we update the previews so how could I get something similar in the editor?
    Something that changes the UI depending on the current resolution in editor. I thought about creating an Update call that checks the Screen.width continuously but an Update is just called in runtime and I just want it for Edit mode.

    Any ideas of how could achieve this ?

    Thank you!
     
    WildMageGames likes this.
  23. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241

    Code (CSharp):
    1. ublic class UIResolutioMgr : MonoBehaviour
    2. {
    3.     private Vector2 gameView;
    4.     void Awake()
    5.     {
    6.         gameView = GameViewUtils.GetCurrentGameViewSize();
    7.         EditorApplication.update += EditorUpdate;
    8.      
    9.     }
    10.  
    11.     private void EditorUpdate()
    12.     {
    13.       //Debug.Log("Editor update");
    14.       if (gameView !=   GameViewUtils.GetCurrentGameViewSize())
    15.       {
    16.           OnChangeRes();
    17.       }
    18.     }
    19.  
    20.     private void OnChangeRes()
    21.     {
    22.         gameView = GameViewUtils.GetCurrentGameViewSize();
    23.        Debug.Log("New res "+gameView.x+" x "+gameView.y);
    24.     }
    Seems this one is working , any suggestions?
     
    WildMageGames likes this.
  24. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    I have a problem with this, every time GameViewUtils.GetCurrentGameViewSize is called, editor focuses are lost so its not possible edit any field on editor while this is running.
    Is there any way I can know when the GameViewSize has changed without using this call?
    Thanks in advance
     
  25. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Hello,

    Such feature is not planned yet, I did not tough about it.

    Can you tell me more about what you are looking for with this feature and how you plan to use it during the preview ? You would like to be able to set some specific presets to have access to internet and generate a preview based on it, for instance to display an error message ? Or are you looking for a global settings for all devices in the same time ?
     
  26. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Thanks for the links :)
    Automating the device list, or sharing it to be updated on github, is something we could indeed look for.

    However, devices with images still need to have their image manually edited and integrated for embedding the device, this is the most time consuming task.

    The data that is missing in all those website is the SafeArea value. To my knowledge there is no such database, and I still need to get those values manually by running the app on the devices. (Also, you can contribute to this if you have devices with notches that do not have safe area values in the asset)

    Is there a particular reason you are asking for this ? Is the loading of presets too slow, or presets too tedious to find in the list ?

    The collection is stored in an asset file that is created with a default name, and you can rename it in the project explorer.

    Sorry for that, I will improve it.
     
    Last edited: Dec 2, 2020
  27. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Hello, sorry for the answer delay (I have a exceptional limited time for support for a few days).

    Using the delegate is indeed a good way to check for the width of the simulated device.

    Also, you could use the simulated values of DeviceInfo, for instance DeviceInfo.GetResolution(), to get the values of the currently simulated device, that also returns the correct editor values when no device is being simulated. (and it is better than GetCurrentGameViewSize() because it will not change the editor focus.)

    You could run your script in an Update() method to check DeviceInfo.GetResolution().x, and add the attribute [RunInEditMode] to your script to its update method is called in edit mode too.

    For the canvas scaler, I would suggest a script that compute the physical size of the screen (using the resolution and PPI) to detect if you want to have big buttons or not. This should also be based on the DeviceInfo values to get the good values, in the simulator but also in the real device. You could also simply create a script to change the scale of a button based on that physical size value that you can compute. (screenWidthInCm = 2.54 * DeviceInfo.GetResolution().x / DeviceInfo.GetDPI() )
     
    Last edited: Dec 2, 2020
  28. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    I finally did the following:

    1. Added a script in the Main Canvas with the event OnRectTransformDimensionsChange
    2. This event calls GameViewUtils.GetCurrentGameViewSize()
    3. I take the gameView width and height and set the different UI elements regarding which resolution I have.

    I didn't know DeviceInfo would get me the correct values in editor, but since the current way is working I'll leave it like that.

    I also stopped using the CanvasScaler because there were some resolutions like tablet I wanted the UI to grow even more and Im using Scale with Screen size with 1.0 match. So basically im modifying slightly the rectTransform scale of some elements and adjusting the anchorPositions. Do you think this is a bad practice?

    Thanks
     
  29. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Glad you got it working :)

    No I do not think this is a bad practice, and using the various preview devices you should be able to see if your scaling script work properly, so it should be OK.
     
  30. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    205
    Have anyone tried to import a list of device profiles in Android Studio's AVD manager? It's hard to find a proper list of device for the emulator. But now, I look at this plugin's comprehensive list of devices and I wonder if some kind of port from Unity to Android Studio could be made.
     
  31. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    I am not aware of any user that manager to export the list to Android Studio's AVD manager. I will study the tool to see if this is something that can be done.
     
  32. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    universal_large-sale7.png

    The asset is on SALE at 50% OFF until January 7th. Do not miss it!
     
  33. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    205
    This is the blacker black Friday.
     
    WildMageGames likes this.
  34. titoasty

    titoasty

    Joined:
    Dec 2, 2018
    Posts:
    7
    Hi,

    I'm using Universal Screenshot Creator and just imported Universal Device Preview, but I'm facing compilation errors... :(
    Using Unity 2020.1.0f1.
    Thanks
     
  35. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Hello

    Thanks for purchasing Universal Device Preview.
    Can you copy paste here your compilation errors ?
     
  36. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    I'm getting different views in editor and device, its like on Editor the asset is not taking into account the Safe Area, or at least seems like that.
    You mentioned it was compatible with safeArea, im using your DeviceCustomBorder script and the device SO's provided with the asset.
    Any idea why the views dont match? Am I missing something?
     
  37. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    241
    Okay I just realize that I have to go to the preview and update it, I thought while running in game was already being simulated accordingly.
     
    WildMageGames likes this.
  38. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219

    Hello,

    Did you solved your issue ? After deep decking, I do not think that the 1px is caused by the safe area component.

    On your picture I can see that the anchor values are correct: 0.04187192 is for the 102 pixel bottom and and 0.9458128 for the 132 pixel top margin.

    Also, the safe area component margin is based on the parent panel, it only change the inner margin using anchors, so for the top it change from the top to bottom, and do not affect the parent size or margin. On your image it looks like its the parent panel (UI_Loading Clone ?) that have the 1px, the SafeArea is selected with the blue dots.

    If you still have that issue you could send me your example scene so I can give it a look.

    Snipaste_2020-10-28_18-05-40.png
     
  39. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    When my project's Unity version is 2019.4.11f1, I find the issue.

    Now I check it again, seems the issue is gone.
    My project upgrade Unity version from 2019.4.11f1 to 2019.4.16f1.

    Snipaste_2021-01-11_17-35-46.png
     
    WildMageGames likes this.
  40. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    Universal Device Preview 1.9.2 has been released on the asset store :)


    1.9.2 - 09/01/2021
    • (NEW FEATURE) Exclude features from build depending on your needs.
    • Unity 2020.2 support.
    • Best selling phones 2020.
    • Ratio names simplified.
    • (Fix) Safe area delay after screen rotation.
    • (Fix) Window error with empty list.
    • (Fix) Washed out preview in URP and HDRP.
    • (Fix) Device and gallery export only selected devices.
    • New devices with safe area:
      • Google Pixel 4a (4G)
      • Xiami Redmi Note 8
      • Xiami Redmi Note 8 Pro
    • Ultimate Screenshot Creator updated to 1.8.1
      • Choose gallery order between name, creation date.
      • Added delegates to the thumbnail component.
      • Cleaned permission needs for iOS and Android.
      • (Fix) Share only works when folder exists.
      • (Fix) Stack overflow with render to texture.
      • (Fix) Export to Pictures folder for Android 10+.


    1.9.1 - 21/10/2020

    READ BEFORE UPDATING.
    Several files have been moved or removed in update 1.8. Because we added assembly files to improve compilation time, it is recommended to do a clean re-install by removing the AlmostEngine folder before importing the update, to prevent any compilation issues. Do not forget to backup your custom prefabs, presets, and configuration files (PhotoUsageDescription.asset, ScreenshotWindowConfig.asset, UniversalDevicePreviewConfig.asset) before doing so. Do not hesitate to contact me if you have any issues or questions.
    • Unity 2020.1 support.
    • Asset now includes assembly files.
    • Minimal supported version is now 2017.4 LTS.
    • New devices presets:
      • Sony Xperia 1
      • Sony Xperia 10
      • Sony Xperia L4
      • Sony Xperia Pro
    • Ultimate Screenshot Creator updated to 1.8
      • (NEW FEATURE) Share your screenshots on iOS, Android and WebGL.
      • (NEW FEATURE) Can now choose to display or not the screenshot in the phone gallery.
      • (NEW FEATURE) API improved to allow capture of screen or camera from one line of code.
      • (Fix) Saving on Windows Store UWP.
      • (Fix) WebGL export on iOS.
     
  41. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    Hi,

    After I upgrade version from 1.9.1 to 1.9.2.
    I got errors on game start.

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.GameObjectInspector.ClearPreviewCache () (at <7d90b28560b644ce87b8263efcc36eed>:0)
    3. UnityEditor.GameObjectInspector.ReloadPreviewInstances () (at <7d90b28560b644ce87b8263efcc36eed>:0)
    4. UnityEditor.GameObjectInspector.OnForceReloadInspector () (at <7d90b28560b644ce87b8263efcc36eed>:0)
    5. UnityEditor.AssetDatabase:Refresh()
    6. AlmostEngine.AssetUtils:GetFirst() (at Assets/AlmostEngine/Shared/Assets/Scripts/AssetUtils.cs:68)
    7. AlmostEngine.ExcludeFromBuildTool.ExcludeFromBuild:GetConfigAsset(Boolean) (at Assets/AlmostEngine/ExcludeFromBuildTool/Assets/Scripts/ExcludeFromBuild.cs:155)
    8. AlmostEngine.ExcludeFromBuildTool.ExcludeFromBuild:.cctor() (at Assets/AlmostEngine/ExcludeFromBuildTool/Assets/Scripts/ExcludeFromBuild.cs:228)
    9. UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.GameObjectInspector.ClearPreviewCache () (at <7d90b28560b644ce87b8263efcc36eed>:0)
    3. UnityEditor.GameObjectInspector.ReloadPreviewInstances () (at <7d90b28560b644ce87b8263efcc36eed>:0)
    4. UnityEditor.GameObjectInspector.OnForceReloadInspector () (at <7d90b28560b644ce87b8263efcc36eed>:0)
    5. UnityEditor.AssetDatabase:Refresh()
    6. AlmostEngine.AssetUtils:GetFirst() (at Assets/AlmostEngine/Shared/Assets/Scripts/AssetUtils.cs:68)
    7. AlmostEngine.Preview.ResolutionSettingsWindow:GetConfig(Boolean) (at Assets/AlmostEngine/UniversalDevicePreview/Assets/Editor/Scripts/ResolutionSettingsWindow.cs:53)
    8. AlmostEngine.Preview.ResolutionSettingsWindow:InitOnLoad() (at Assets/AlmostEngine/UniversalDevicePreview/Assets/Editor/Scripts/ResolutionSettingsWindow.cs:24)
     
  42. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219

    Hello,

    Sorry for the bug. Can you give me more details on your Unity version and on what OS you are ?
    I will send you an updated script by private message.
     
  43. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    My Unity version is 2019.4.16f1 (64-bit)
    OS Win10 2004

    Did this error message is my project plugin setting is something wrong?
     
  44. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    219
    I do not know, I will try to reproduce the issue.

    I sent you an private message with the corrected script attached, did you received it ?
     
  45. Timmy-Hsu

    Timmy-Hsu

    Joined:
    Aug 27, 2015
    Posts:
    34
    I only Check iPhoneX Device, and set Drawing mode to Texture Only
    I create a new project to reproduce the issue, will send you an private message about download url.

    Snipaste_2021-01-21_14-24-29.png
     
unityunity