UI Grid layout not working

So I have a scrolling frame that I want to adjust based on the content size and it has a UI Grid Layout inside it. However whenever the Canvas Size is below a certain value then all the cells become really small. Here is what it looks like normally (Canvas size of {0, 0} {2, 0})
image
And here is what it looks like after the canvas size Y has been decreased (Canvas size of {0, 0} {0, 110})
image

I can upload some code however this has nothing to do with the code. Just by making the canvas size smaller in the properties I get this. I’m not sure if this helps but the cell size for the grid layout is {0.319, 0},{0.065, 0}. Any help would be much appreciated.

Here is the code

script.Parent.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, script.Parent.ScrollingFrame.UIGridLayout.AbsoluteCellCount.Y * script.Parent.ScrollingFrame.UIGridLayout.AbsoluteCellSize.Y)

I have tried using absolute content size but that didn’t work so I attempted this but this didn’t work either

1 Like

I think the issue is that you may have to use Offset for the cells inside of the ScrollingFrame, not Scale. Because if it’s scale, it will change size if the CanvasSize is increased/decreased, whereas it wont with Offset.

I have tried using offset but I would like the size of the cells to scale across different devices. I am also using a UIAspectRatioConstraint to keep the height of the cell proportional to the width so that is doesn’t change when the canvas size changes. Weirdly when I increase the canvas size to e.g. {0, 0}{5, 0} or {0, 0}{0, 1000} then the sizes of the cells stays the same. It only changes when I go below a certain size

Is it not possible for you to prevent the CanvasSize from going less than that threshold or would that also cause issues?

Well I could but there’s no way for me to calculate the size needed for the scrolling frame. I posted my code above and that automatically tries to fit like 7 cells in the X instead of 2.Basically all the content size and everything is based on the small cells

It definitely has to be something with the Scale and Offset, try messing around with the Cell’s size and what not and see if you can find a compromise that works and works for all screens