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

Scaling problems + Preserve Aspect

Discussion in 'UGUI & TextMesh Pro' started by Dam-Pete, Dec 8, 2014.

  1. Dam-Pete

    Dam-Pete

    Joined:
    Jun 11, 2010
    Posts:
    54
    One problem I have encountered is having my screen scale to resolutions of different aspects. I have a certain element which contains children, this element needs to preserve aspect ratio. First issue is this is only available (as far as I know) to Images, which is okay until now because the element in question is actually an Image. This, however, doesn't solve the problem. If I check the option to preserve aspect ratio, the child elements don't anchor correctly. If I leave it unchecked, the anchors work fine, but the final UI element becomes distorted.

    I've attached sample images to show precisely what happens. The first image is how I have set up my UI element, the other 2 are how they look on a wider aspect ratio, for example, with and without "Preserve Aspect" marked on the parent Image. The image's aspect is preserved, but the UI element's scale isn't, which doesn't allow the proper anchoring, as far as I have tried.

    Any ideas on how to get this working properly?
     

    Attached Files:

  2. runevision

    runevision

    Joined:
    Nov 28, 2007
    Posts:
    1,892
    If you want all of the UI to scale this way, maybe this page in the manual can help:
    http://docs.unity3d.com/Manual/HOWTO-UIMultiResolution.html

    Otherwise there is also this:
    http://docs.unity3d.com/Manual/script-AspectRatioFitter.html

    I really recommend you browse the various pages in the UI section of the manual a bit, since I've noticed you've been asking a few different questions that are already answered in the docs. :)
     
  3. Dam-Pete

    Dam-Pete

    Joined:
    Jun 11, 2010
    Posts:
    54
    I'll check those out, thanks for the links. I did navigate a bit through the manual, but I have found the whole UI system (documentation included) a tad obscure compared to NGUI (which I'm used to and may be the cause of my adaptation issues). I'm sorry about asking questions that are covered in the documentation though, I do recognize it is my fault.