Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mobile setup screen resolution recommendations

Discussion in 'Getting Started' started by jshrek, Feb 24, 2015.

  1. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Hi

    So I want to setup a new mobile project that I will be deploying to iOS, Android, BlackBerry and Windows Phone.

    What screen resolution should I start with, that will be best all around choice for all these platforms?

    Thanks
     
    goldcloud144 likes this.
  2. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    So to answer my own question, I finally realized that you don't really need to work with screen resolutions for mobile.

    For example for iOS and Android you can choose 16:9 or 4:3 (and 1:1 for BlackBerry) when testing in the editor. You then just need to make sure game looks proper and works right for those aspect ratios that you want to target and then let Unity worry about what happens after you Build it.
     
    fedemg15, alarm656 and kapopixel like this.
  3. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    There's also 5:4 and 16:10 :)

    As long as you have HD images for the larger resolutions, and controls follow the right edges/corners desired, you should be fine. You should probably get a few testers with different devices to be on the safe side.
     
    BitPax likes this.
  4. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Okay so that brings up a good question ...

    What does "HD image" actually mean?

    Is a background of 2048x2048 going to be sufficient for most mobile devices including tablets?

    And what about say an image that is used as a button? How big will it resize until it becomes pixelated?

    Just things I am wondering!
     
  5. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    I'm only referring to buttons and such smaller elements here; a background DESIGNED to fill the entire screen would of course be more appropriate to create at the target resolution. But you'd probably want to go easy on huge images and tile smaller ones instead.

    Buttons and icons could probably be designed at the highest resolution required in most cases, and scaled down for phones with lower resolutions. If you consider the resolutions of the devices you want to support, what is the smallest phone resolution? Mock up an image at that size, paste down some of your widget/icon art, and scale the image down until it looks roughly phone-sized on your screen. If you can still see the elements, it's all good :)

    You can also get a rough idea of sizes for a Retina-style screen (2048x1536 and up) by mocking up an iOS interface in Xcode and looking at the sizes there. These are point sizes, so on a pre-Retina screen it's pixels, on Retina it's twice that size in each direction.

    If VRAM could be an issue, you'd want to supply quarter-sized versions of all images for lower resolution devices (half width and size), and use whatever means are available to you to select the one appropriate for the current device. It depends on how much you want to bloat the package, and if you want to support anything but the newest, shiniest hardware.
     
  6. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Thanks orb ...

    Does Unity have any automatic way of choosing half-sized images at lower resolution? Or does this need to be programmed somehow via a script?

    Thanks
     
  7. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    It looks like there still isn't anything automatic for it, but people suggest you read the Screen class to get the resolution/DPI and figure it out from there.
     
  8. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    Okay, thank you for input.
     
  9. jshrek

    jshrek

    Joined:
    Mar 30, 2013
    Posts:
    220
    So after playing around a little bit, I added the following code to Start() method of my GameController.cs script. It basically determines the left/right limits of player movement based on screen ratio.

    Code (Csharp):
    1. //set player control limits to screen width
    2. theScreenWidth = Screen.width;
    3. theScreenHeight = Screen.height;
    4. theScreenRatio = theScreenWidth / theScreenHeight; //this determines the screen ratio (3:4=iPad_Tall, 9:16=iPhone5_Tall, etc)
    5.  
    6. //NOTES
    7. // The screen ratio calculations below are based on PORTRAIT mode (3:4 & 9:16 is for portrait mode). For LANDSCAPE mode you would need different numbers (4:3 & 16:9 is landscape mode).
    8. // The player limit numbers I needed to work with in portrait were 7 for 3:4 and 5 for 9:16. So screen ratio of .75 needed to calculate to 7 and screen ratio of .5625 needed to calculate to 5, so that's where this weird formula below comes from.
    9.  
    10. theXMax = 7 - (10.67f * (.75f - theScreenRatio)); //Need theXMax values for screen ratio of 4:3(.75)=7 and for 16:9(.5625)=5
    11.  
    12. //set some min and max values regardless of screen ratio
    13. if (theXMax > 9.9f) {
    14.     theXMax = 9.9f; //Limit on boundary is 10
    15. }
    16. if (theXMax < 1.0f) {
    17.     theXMax = 1.0f;
    18. }
    19.  
    20. //set the range for player movement for 3:4 from +7 to -7 and for 9:16 from +5 to -5
    21. theXMin = -theXMax;
    22. playerController.boundary.xMax = theXMax; //set player boundary to right
    23. playerController.boundary.xMin = theXMin; //set player boundary to left
    24.  
    So basically regardless of the screen ratio size, moving my player left to right will always go to the outer edge.
     
    serkillium, Faakuu and Bagheera like this.