Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Supporting multiple screen resolutions

Discussion in 'UGUI & TextMesh Pro' started by crushforth, Mar 29, 2016.

  1. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    Is the current method of using asset bundle variants still the recommended method of handling different resolutions / dpi's?

    I'm about to start implementing this but thought I'd ask how other people structured everything before I start.

    Do you group your sprites in folders names like @1x, @2x, @3x (iOS style) or something more Android style like: xhdpi, xxhdpi, etc...

    We'll probably have to support just about any device from mobile to desktop & WebGL and everything in between so I was sort of leaning towards more the android model and selecting the correct bundle based on the Screen.dpi and its distance from the following dpi's:

    • ldpi (low) ~120dpi
    • mdpi (medium) ~160dpi
    • hdpi (high) ~240dpi
    • xhdpi (extra-high) ~320dpi
    • xxhdpi (extra-extra-high) ~480dpi
    • xxxhdpi (extra-extra-extra-high) ~640dpi
    Not sure yet.

    I like the idea in this forum (http://forum.unity3d.com/threads/of...t-fail-to-satisfy-your-hd-sd-use-case.375716/) about generating the smaller sizes from the larger versions so we don't have to worry about missing sizes and the sprite borders being setup incorrectly.

    Any tips or best practices would be greatly appreciated.
     
    Last edited: Mar 29, 2016
  2. crushforth

    crushforth

    Joined:
    Jul 22, 2010
    Posts:
    113
    Just in case anyone in the future is curious. I implemented everything as asset bundle variants and it was fairly painless. The only issue is testing asset bundle variants in the editor (and testing if all the sprites have the correct 9 slice borders setup).

    I'm using an old'ish version of AssetBundleManager (I should really check to see if it has been updated recently) and when you turn off 'Simulation Mode' and setup the asset bundle server you can get somewhere close to being able to test in the editor. There are a few issues though. If you're active deployment target is iOS it will use the iOS bundles which won't work properly (lots of magenta shaders). The fix for this is to obviously build the correct standalone/desktop versions. Also if you have UISprites in prefabs they don't find their images properly from within the bundle, you get sort of texture corruption like its using invalid parts of the atlas. All of these problems go away when deployed to an actual device using the correct asset bundles and not running within the editor.
     
    kiles likes this.