Search Unity

Question How to support 32:9 resolutions all the way to 3:2?

Discussion in 'UGUI & TextMesh Pro' started by f0ff886f, May 11, 2020.

  1. f0ff886f

    f0ff886f

    Joined:
    Nov 1, 2015
    Posts:
    201
    Hi,

    I'm having a rough time figuring out how to setup the canvas scaler and some elements so that things "just work" in our game.

    We have an image that is 1920px wide that we use as the background for loading screens, as a sprite. Then I have text that is offset from the left edge.

    Right now, scaling down to 3:2 works fine: the image gets scaled down, the text keeps hugging the left edge. However, going to 32:9 just makes the text HUGE on the relative screen size, and completely chops off the bottom and top.

    That is with the canvas set up like so:
    upload_2020-5-11_22-30-34.png

    Now if I switch the match to "Height", 32:9 starts to work, but 3:2 gets cut off on the sides.

    I know I'll have to adjust the background image to handle the ridiculous width of 32:9 monitors, but I'm at a loss how to keep things working throughout the aspect ratios.

    Is the expectation that some script manages the canvas scaler based on actual screen geometry? Or are there other ways to approach this problem?

    I'd love to have the text hug the left margin, but only up until a certain point too. So at 32:9 don't put the loading text at the left margin of the monitor, but still relatively centered (as if you had a 1920px wide frame over the middle of the monitor). And for anything with a narrower aspect ratio than 16:9, keep hugging the width.

    I can make some images if this isn't clear.

    If anyone has ideas, it would be much appreciated.
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    Because I also had a lot of problems with the canvas scaler I created an extension for UGUI to make all this more controllable.
    However, I don't fully understand what problems you face without screenshots. Maybe you don't need my Asset (Better UI, see signature) and can achieve your goals differently. So, if you would post some screenshots I could maybe tell you if you can fix it without a third-party asset.