As a Roblox developer, it is currently too hard to read how many cells are being displayed along the x axis inside of a UIGridLayout-organized GuiObject.
For example,
You can set the FillDirectionMaxCells, but you cannot easily read how many of those cells are currently being displayed along the FillDirection axis, as it varies depending on the absolute size of the element vs the cell size/cell padding!
What I am suggesting is a read-only property of UIGridLayout that returns the CurrentFillDirectionCells. I imagine this would be simple to implement, as clearly the engine is already determining how many cells are allowed to fit inside of the layout’s fill direction.
Here is a quick example of how I am currently detecting this:
-- pass all the GuiObjects inside of the UIGridLayout-organized frame. (Direct children)
local function GetHorizontalAmount(objs)
local horizontal_amount = -1
local absolutes = {}
for i=1, #objs do -- loop thru all the frames
local o = objs[i]
local absolute_y = o.AbsolutePosition.Y
if absolutes[absolute_y] then -- if this absolute y exists in the table, add this obj
table.insert(absolutes[absolute_y], o)
else
absolutes[absolute_y] = {} -- if it doesn't, create it.
table.insert(absolutes[absolute_y], o) -- then add this obj.
end
end
for absolute_y, gui_objs in pairs(absolutes) do -- loop thru the absolutes
if #gui_objs > horizontal_amount then -- if this absolute_y has more frames than the current horizontal_amount then, update the horizontal amount
horizontal_amount = #gui_objs
end
end
return horizontal_amount -- return the current horizontal amount.
end
You would obviously have to adjust this function to get the amount if your FillDirection is on the Y axis.