Search Unity

Unity UI Size vertical layout group to its [expandable] children

Discussion in 'UGUI & TextMesh Pro' started by andyz, Apr 17, 2019.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    One thing the UI system seems to lack is an easy way to make a scrollable list of elements with at least some of those elements being expandable. One old thread on this exists here: https://forum.unity.com/threads/layout-group-and-contentsizefitter-in-child.343082/

    On the most basic level making a vertical layout group resize its height to that of all children - this is done with a content size fitter? But then you can not have a content size fitter on a child without getting a warning "Parent has a type of layout group component..."

    The "Child controls size" and "Child Force Expand" seem to be labelled incorrectly on layout groups and it is actually "Layout Group Controls Child size" and "Layout Group Force Expands Children", but sometimes you need "Children control layout group size" which I had to do in code and if one child expands in size this must be updated.