Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

[Unity 5.2] Problems with nested vertical layout groups

Discussion in 'UGUI & TextMesh Pro' started by tomtu, Sep 11, 2015.

  1. tomtu


    Jan 7, 2015
    Nested layout groups don't seem to work or don't seem to work as expected after upgrade to 5.2.

    In 4.6-5.1.x we had no problems using multiple level of nesting with vertical/horizontal layout groups (sometimes with content size fitter on top of it) but after upgrading in some scenarios it seems like when having multiple levels of nested layout groups RectTransforms are not being controlled by parent layout groups and just retain whatever position/sizing they had before entering Play Mode.

    Not sure if it's a bug or change in desired behaviour? Will try to dive deeper with this one but for the time being it forces us to stay with 5.1.x. Leaving this in case anybody stumbles with this one as well and hope we can figure out what's causing this "phenomenon"

    *edit with update*

    Using LayoutRebuilder.ForceRebuildLayoutImmediate before view is displayed causes it to get bit better - autolayouting is still disabled but it manages to get "close" to what it should look like. For some reason PreferredHeight / MinHeight of LayoutElement are being ignored and everything is cramped together as if it was driven by text elements instead

    *edit two*

    Using LayoutRebuilder.MarkLayoutForRebuild when anything in the view changes and replacing all preferredHeights with MinHeights gets it almost to how it would look with autolayouting but it's messy - requires slapping content size fitter almost everywhere and uh!


    Is there anything that could cause autolayouting to simply stop working??? some kind of root/parent RectTransform corruption or some kind of setting/condition i'm missing?

    works fine in all of the app (VERY UI Heavy app (80% of app?) so autolayouting is pushed to its limits and seems that but for whatever reason in two places it just breaks.

    One guess is that changes to 5.2 somehow changed the order in which different autolayout behaviours are applied... will try to get back to it with clear head for now we'll stick to 5.1 probably and wait for patches

    Last edited: Sep 12, 2015
    IgorAherne, t-samukawa-mb and otez like this.