Search Issue Tracker

Won't Fix



Found in


Issue ID




Parent ContentSizeFitter doesn't update own size when child's ContentSizeFitter changes size



To reproduce:
1. Open user's project
2. In Hierarchy window, check Parent object height - it's 300
3. Find and disable Granchild object
4. Check Child 1 height (0) and Parent object height (still 300)

Expected: after disabling Granchild, Child 1 height is set to 0 and Parent height is set to 200
Actual: after disabling Granchild, Child 1 height is set to 0, Parent height is still 300

Reproduced in: 5.4.5p3, 5.5.4f1, 5.6.1p4, 5.6.2f1, 2017.1.0b10, 2017.2.0a4

Note: Content Size Filter warning states that child layout should not have Content Size Filter itself, however, it doesn't state that it wouldn't work
Note: from 2017.2 and before 5.6, bug shows different behavior - Parent object shows height of 200 no matter the state of Granchild

Comments (4)

  1. 040e156173ba5d6e7fa458011862611e?d=mm


    Oct 26, 2017 16:51

    Fixed in 2017.2 (at least it works for me now as intended, without the LayoutRebuilder magic).

  2. 3c08cc86606da523748c9527e76253f4?d=mm


    Sep 13, 2017 07:14

    The wanted behavior works only if you add a horizontal or a vertical layout group to the element you put the content size fitters on, but it would be really nice if it would work without them

  3. 3c08cc86606da523748c9527e76253f4?d=mm


    Sep 13, 2017 07:06

    same here the contentsizefitter is somehow buggy

    even with a very simple setup the parent does not expand to prefered size to fit the size of its child

    just try it, it's mad , add a standard panel on this add a standard text put a contentsizefitter on the text and on the panel , set both fitters to prefered width, the text is set to fit the size of the text but the panel isnt fitting the size of the child with the text.

  4. 040e156173ba5d6e7fa458011862611e?d=mm


    Jul 17, 2017 22:04

    Same problem here, less complex scenario (scroll view with prefab children having ContentSizeFitter).
    It looks like Unity works the hierarchy the wrong way: up-to-down (parent to child, then child's child, etc), instead down-to-up (starting from the greatest grandchild)

    WORKAROUND for those who struggle:

    if this doesn't help on it's own, also call on parent's parent, right AFTER called on the child:

    If your hierarchy is deeper, try to go 1-1 level higher by adding another ".parent.transform" and test, such as:


    If you have a very deep hierarchy and there are ContentSizeFitters on every level, when it finally works, try to remove the 1st call, if still OK the 2nd, and so on until you get the least possible calls and your UI doesn't fall apart.

    If too slow, you should find a way to get rid of ContentSizeFitter on child and grandchild GOs some way

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.