How do I auto scale Canvas size for a UIGridLayout

I’m trying to scale this scrolling frames canvas size to fit the number of objects in it but I don’t know-how
(I have looked for solutions and I cannot seem to find an answer!)

Here is what I’m talking about:

image

I am using scaled objects and I am using a UIGridLayout, any help or suggestions would be useful. Thank you!

1 Like

There is a property in the ScrollingFrame called ScrollingFrame.AutomaticCanvasSize (roblox.com). Change CanvasSize to {0, 0}, {0, 0} though to make sure there isn’t a scrollbar yet when the frame is not filled up yet.

Though when the canvas size gets bigger if something is scaled it will become longer. This is due to the AbsoluteSize of the scrolling frame getting bigger when the canvas size gets bigger. This can be ignored by using offset which is in pixels, or you can use a script that will resize the CellSize when the scrolling frame’s AbsoluteSize changes.

11 Likes

Wow this helps a lot, I never knew you had to set the CanvasSize all to 0. Roblox should include this in their article.

@EthicalCode you’ve probably already figured it out but… set the scrolling frame “automatic canvas size” to Y, and set the “Canvas Size” to {0, 0}, {0, 0} like previously mentioned

1 Like