Search Unity

Unity UI [SOLVED] Elements of a menu with VerticalLayoutGroup don't align properly when some are removed

Discussion in 'UGUI & TextMesh Pro' started by Vencarii, Mar 2, 2019.

  1. Vencarii

    Vencarii

    Joined:
    May 19, 2016
    Posts:
    9
    Hello,

    I have a menu with elements on it, they are aligned vertically with a VerticalLayoutGroup and a Content Size Fitter.
    When I remove some elements, the remaining elements don't align to the top of the menu, but in the center. The Child Alignment setting in the VerticalLayoutGroup is already set to Upper Center.
    Maybe someone has an idea how to fix that?

    I tried to add the images here, but the forums image button seems to be broken, so here is the link to my Answers thread instead: https://answers.unity.com/questions/1607847/elements-of-menu-with-verticallayoutgroup-dont-ali.html
     
  2. Vencarii

    Vencarii

    Joined:
    May 19, 2016
    Posts:
    9
    EDIT:

    Okay I fixed it myself. The problem was the pivot point of the container that has the Vertical Layout Group and the Content Size Fitter attached. I changed the pivot point of the RectTransform to top center and now it works fine, the elements are aligned to the top! :)
     
    Last edited: Mar 9, 2019
unityunity