After doing the following reproduction steps the game freezes OR crashes.
Reproduction steps:
Create a “container” frame, in a screenGui in the starterGui service, set its size from scale to (1, 1) & set its transparency to 1 (-> this frame’s properties has nothing to do with the issue)
Create a UIGridLayout inside of the container frame, set its cellSize to (0, 0, 0, 0) & set its cellPadding from scale to (0.000001, 0.000001) (-> The more the numbers are close to zero (but not zero) the more the game will freeze or crash instantly)
Create some “element” frames inside the container frame (-> we want small elements and big elements in our grid: step 4)
In one of the element frames, add a UISizeConstraint & set its minSize to anything larger than (0, 0) (-> like (64, 64) or (128, 128)).
The game crashes
Screenshots of the explorer, properties and viewport:
What I was wanting to do was a grid that contains frames which sizes would be different (so bypassing the cellSize limit that applies to every single frames)
I found out I could do that using UISizeConstraints and by setting the grid’s cellSize from scale to (0, 0)
The thing was, the UI padding needed to not be zero, (it was working properly setting the padding from offset to (1, 1))
But I wanted zero padding or near zero padding
So after thinking a bit, I decided to try putting the scale padding to a small digit like 0.00001, this lead to my game crashing while I expected the grid to appear but with a really small invisible padding.
While we never want the engine to crash, I don’t think the fix will do what you want.
The values you’re providing here create a 1 million by 1 million grid layout, for a total number of cells of 1 trillion. Each cell uses a small amount of memory, about 24 bytes, so this would require 24 terabytes of memory, causing a crash. The fix here would be to disallow such small values.
Can you show your usecase for using such small cell sizes? The main one I’ve seen in the past was to be able to control the cell aspect ratio, which can be done more efficiently by adding a UIAspectRatioConstraint as a child of the UIGridLayout. (This is never communicated in the UI, so it’s easy to miss.)
If you need 100% control over the sizing and placement, it might be better to manually set Position/Size instead and not use GridLayout for this purpose.
I enabled a fix that limits the minimum cell size to 1 pixel, preventing the crash. (Last month actually, forgot to make this reply until now.) Feel free to make a new feature request or bug report if there’s still something missing!
For that screenshot you posted, it looks like that could be done by adding a UISizeConstraint to the orange square and setting its MinSize to twice the cell size of the other squares.