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

Bug Vertical Layout Group expends only after interaction with children

Discussion in 'UGUI & TextMesh Pro' started by TwelveFourtySeven, Mar 1, 2024.

  1. TwelveFourtySeven

    TwelveFourtySeven

    Joined:
    Dec 21, 2023
    Posts:
    5
    I have an issue with a vertical group layout. It is a child of an empty parent, lets name it scrollObject, that consist of a scroll rect, layout element and a rect mask. Scroll object initself is a child of a vertical layout group, therefore it has a layout element preferred height set to 900. So the vertical group layout object has the group object, content fitter(set up for preferred height) and a layout element to fit the size in width. The issue that when any objects are added to the group, they all appear in a small box, which is the starting size of the object and can not be altered.(If thee layout element preferred or minimum height are changed, then the scroll doesnt work) But when any interactions are made to the children(I have a button in them), the height adjusts correctly. So how is it possible to fix?
     
  2. JuliaP_Unity

    JuliaP_Unity

    Unity Technologies

    Joined:
    Mar 26, 2020
    Posts:
    705
    If you observe the inspector closely, you'll see that combining layout groups with content size fitters triggers a warning. It's technically not supported to mix those components, as you're seeing. The way to fix it is to eliminate one or the other unfortunately.
     
  3. xucian

    xucian

    Joined:
    Mar 7, 2016
    Posts:
    850
    "It's dangerous to go alone! Take this"