- Edited
Scenario: I have a ResponsiveContainer with behaviour set to 'Fit Container To Content'.
Initially it has zero children, so its RectTransform Height is zero. For some reason the height of the container can't be manually edited in Editor (non-Play) mode to 10 or greater (it automatically resets to zero), possibly because I have all the margins/spacing set to zero?
In Play mode, if I instantiate a new ResponsiveItem gameobject and add it as a child of the container, the container won't resize to accomodate the new child. This happens even if I call Resize(true) on the container.
If, however, (in play mode) I manually adjust the container's height, as soon as it reaches 10 it suddenly behaves correctly ie resizes to a height which accommodates all its children.
Looking at the code, it's this bit that prevents the container being resized automatically during play mode:
if (ch < 10 || cw < 10)
return;
since the height is still zero at the time this code is called.
Would appreciate it if you could investigate this please.
Thank you!