I have expandable children within a VerticalLayoutGroup but it seems the layout groups do not respond to child size changes nor can be easily pursuaded to in code except by disabling and enabling them! (
layoutGroup.enabled = false; layoutGroup.enabled = true; )
Is this the only way?
Also would be nice if a layoutgroup could control its RectTransform size so if being used in scrollview content it controls the size of the content area.
Also the ‘Child Controls Size’ and ‘Child Force Expand’ - I think the correct way to read them is Control Child Size and Force Expand Children, but as per above if you could have Children Control Size it would be useful
Hello,
I had these issue for so long time and find these solution:
this.InitUI();
this.ContentSizeFitter.enabled = false;
this.ContentSizeFitter.SetLayoutVertical(); // can use SetLayoutHorizontal as well
LayoutRebuilder.ForceRebuildLayoutImmediate( this.RectTrans );
this.ContentSizeFitter.enabled = true;
So you need to stock your ContentSizeFitter and the RectTransform but it works properly.