Issue with preferred size of content size fitter

Hello,

I am using a content size fitter component on the grid layout group child of a scroll rect view. This child is composed of several others grid layout group. Each of them has a content size fitter but the direct child of the scroll rect view doesn’t get resized according to the size of its children.

I am working on a scroll view for a leader board with 4 sections (Completed, Current, Pending, Get reward), so the hierarchy is the following one.

Scroll rect
GridLayoutGroup
CompletedGridLayoutGroup
CurrentGridLayoutGroup
And so on…

If anyone has an advice I’d be more to happy :slight_smile:

Thanks for your help

It seems like a strange layout, but, in general, a content size fitter can only become the correct height if a direct child is a thing that provides its height, such as a vertical group.

Try putting your GridLayoutGroup inside a VerticalLayoutGroup, maybe on the Content item referenced by the ScrollRect.

1 Like