Content size fitter inside vertical layout group

I have a scroll rect that contains a vertical layout group which contains multiple text elements. This works fine when each text element has a predefined height, but what I’d like to do is put a content size fitter on them so that they will expand their height to fit the text inside them. Unity doesn’t seem to like this though, as it puts a warning on the content size fitter, and the scene can be infinity saved with it still complaining it hasn’t been saved. The UI elements also seem to jump around occasionally, even in the editor view. Is there any way to properly accomplish this?

1 Like

This has confused me a lot in the past, and continues to do so sometimes still…

I tried a simple setup like yours, without knowing your exact design.
Scroll View → content (has vertical layout)(could also have content size fitter) → Text (n number of elements)

The vertical layout has : Child Controls size : width + height.
The text elements have a ‘layout element’ and all i set was "flexible width = 1’

I’m not a pro at the layout fitting, but if this helps you…great :slight_smile:

3 Likes

Yep, that was the solution, thanks!

Cool, glad it worked for ya :slight_smile:

wow, that save me a day, thank you.