Search Unity

Bug Aspect Ratio Filter not being applied

Discussion in 'UGUI & TextMesh Pro' started by gillemp, Jul 13, 2021.

?

Is it a bug?

  1. Yes

    100.0%
  2. No

    0 vote(s)
    0.0%
  1. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    Hi!

    I think I found a bug in Unity. I am using the version 2020.3.13f1, and I cannot find any solution or reason for this issue.

    I have a horizontal layout to put 2 elements one after the other in a horizontal row. However, I want the elements to be left-aligned with a fixed aspect ratio for the first and the second to fill the rest of the space.

    The second one is the host of another horizontal layout. All the elements in that layout have the same aspect ratio "forced" by the aspect ratio filter.

    However, it doesn't work. All the elements are "smashed" together but if I disable and enable again any of the Aspect Ratio Filters, the issue is fixed. I tried to do that as a workaround with code, but it didn't wok. To fix it, I have to disable/enable the filters manually in the editor.

    Here is how it should look (and how it looks after resetting ANY of the aspect ratio filters):
    upload_2021-7-14_0-44-10.png

    Here is how it actually looks:
    upload_2021-7-14_0-44-32.png
     
    Last edited: Jul 22, 2021
  2. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
  3. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    An Issue has been created in the Unity Issue Tracker.
    You can vote for it here.
     
  4. gillemp

    gillemp

    Joined:
    Nov 23, 2015
    Posts:
    81
    As said in the resolution, the recommended workaround is using "LayoutRebuilder.MarkLayoutForRebuild(HorizontalLayoutGroup)". More info in the issue itself
     
    Crokett likes this.