Search Unity

What is the ratio between aspect ratio and pixels?

Discussion in 'UGUI & TextMesh Pro' started by tomang5, Sep 18, 2020.

  1. tomang5

    tomang5

    Joined:
    Feb 18, 2020
    Posts:
    63
    Hi all,

    I'm trying to figure out what is the ratio between the aspect ratio and the pixels. For example; I made my UI depending on the 1920x1080 resolution, which is the aspect ratio of 16:9. If I put an image that covers 600 pixels on the screen (and set its anchor correctly - stretch), and change the aspect ratio to 21:9, the image covers ~687 pixels, which is not something I understand. The ratio between 16 and 21 is 1.3125, so I was expecting the image to be ~787 pixels. However, the image extends as if the ratio is 1.145.

    How should I approach when try to find out the ratio? 16:9 is my reference point. If someone plays the game with an aspect ratio of 21:9, I need to change a value of a parameter depending on the aspect ratio, but I couldn't find any relation.
     
    Last edited: Sep 18, 2020
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    I do not fully understand your question but I believe you are looking for this answer: Learn how to use anchors.
    Here is a video I made for my asset Better UI, but it contains also helpful information about anchors in general: