Search Unity

Unity UI handling 4:3 aspect ratio from mockups prepared for 16:9.

Discussion in 'UGUI & TextMesh Pro' started by MichalDev, Dec 24, 2018.

  1. MichalDev

    MichalDev

    Joined:
    Mar 1, 2017
    Posts:
    33
    Hey guys, I am currently working on a responsive UI for mobile game. Has anyone come across situation similiar to the one in an attached picture? So in a nutshell, let's treat 16:9 (cyan color) aspect ratio as an entry point. When device has 4:3 (blue color) aspect ratio (like most of the iPads) I want the buttons (basically all UI elements ignoring backgrounds. I.e. white square in the image below) to stay at the same place and just add some margins on top and bottom. Considering the layout we've prepared those spaces shouldn't be a problem. The main goal of this is to avoid the problem of lack of horizontal spaces because I have a lot of sensitive content that needs to be displayed on all types of devices. If someone know how to handle it without pain, please leave a comment. Thank you very much and I wish you all Merry Christmas.

    screen-sizes.PNG
     
  2. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    Set the Anchor Presets of the image's RectTransform to "middle left" like so.
    upload_2018-12-24_19-39-56.png
     
  3. MichalDev

    MichalDev

    Joined:
    Mar 1, 2017
    Posts:
    33
    It has nothing in common with anchoring, because by default when you change aspect from 16:9 to 4:3 rightmost and leftmost elements naturally get closer to the center even when they're anchored.