Vertical layout group expand issue

Hello!

I have the following UI layout:

  • Vertical layout group

  • Top (also a vertical layout group)

  • Middle

  • Bottom (also a vertical layout group)

My problem is if I disable “child force expand height”, then the Top and Bottom get correct heights that fit their content at all… except for the Middle (which doesn’t have its own vertical layout group) that gets completely squashed.

How can I force the Middle group to expand vertically and take up all available space without, in turn, squashing the contents of Top and Bottom?

Add a LayoutElement component to Middle, and set its Flexible Height to 1.

1 Like

Thank you so much, that worked perfectly!

I had a read of the help page for “flexible height” so then I tried to apply it to one of the content groups inside of that middle area. That’s an empty gameobject with nine text boxes inside of it, each box in the corner. But no option in the Layout Element component seems to affect it.

My entire UI layout has it’s position and size greyed out now (as it should be) except that group with the text elements in the corner. Do you know why? (Perhaps I should start a new thread for this, though…)