Content Size Fitter fails to drive size...but works if game view is resized?

I have some UI elements whose sizes are driven by Content Size Fitters. These objects are hidden (disabled) within the scene but revealed (enabled) by script when I start the game. (The following bug does not occur if the objects are enabled within the scene before I start the game.)

These UI elements appear to be invisible, even though they are shown as enabled within the hierarchy and inspector. The issue seems to be that the Content Size Fitter is not driving their sizes (the “Some values driven by Content Size Fitter” label is missing from the Rect Transform component in the inspector), so their widths and heights are 0 (hence, they are “invisible”).

However, I can “force” the Content Size Fitters to drive their sizes by doing one (or some combination) of the following while the game is running:

  • changing the aspect ratio of the game view
  • minimizing/maximizing the game view
  • pausing/unpausing the game

I don’t know why these actions are causing the Content Size Fitters to take effect, but this seems like a bug to me. Anyone else experienced this? I first encountered in 4.6.0 b3 and it seems to still be in all the versions since.

Exactly same here

LayoutRebuilder.ForceRebuildLayoutImmediate() might work?

unrelated… remembering the issue.

yea… this was an interesting feature to implement in kissUI. :confused:

go it to work by telling all children which parents required content resizing.
works great on multiple ancestors as needed. :]

I m sorry but copy paste this line doesnt explain so much and doesnt works…

I fixed it with an ienumerator which change something on canvas after a certain delay… Like that it forces the resize. That is a way…