We use UIGridStyleLayout.AbsoluteContentSize to update the CanvasSize used for ScrollingFrame’s in our game (Minion Simulator). There is an update that keeps getting A/B tested on the platform where it will give an AbsoluteContentSize of some huge number, which results in our ScrollingFrame CanvasSize’s being huge, making the content basically invisible. It also effects the relative scaling of all of the components.
This has happened a couple of time, and Roblox has reverted the change causing the issue to our game every time. This happens without us pushing an update to our experience at all. The last two times we spent about 5-6 hours fixing it, and then all of the sudden out of nowhere it will just be fixed in our live-game even though we didn’t touch it yet again.
We’re not sure what the underlying issue is here, as it seems to be internal to the engine. It is negatively impacting our experience because the shop, inventory, etc are unusable.
Expected Behavior
AbsoluteContentSize should return the size of the content, not a huge number.
Actual Behavior
AbsoluteContentSize is returning a massive number.
Workaround
Reworking all of our UIs to use UIAspectRatioConstraint’s
Issue Area: Engine Issue Type: Display Impact: Critical Frequency: Constantly Date First Experienced: 2022-12-08 20:12:00 (-06:00) Date Last Experienced: 2022-12-09 00:12:00 (-06:00)
Worth asking but does this affect your ability to use AutomaticSize if you’re able to use it (on the canvas, not the frame)? That sort of superseded the old method of updating CanvasSize according to AbsoluteContentSize. It also allows you to keep using scale over offset when sizing elements.
Unexpected values for AbsoluteContentSize would still be a problem especially for use cases explicitly requiring those values but for this case of handling the CanvasSize of a ScrollingFrame, using its automatic resizing properties should not only be a good workaround but even an alternate and better solution to what you currently do.
Unfortunately AutomaticSize cannot be used in the situation we’re in.
Basically it’s a
Frame => ScrollingFrame => UIListLayout
The ScrollingFrame has AutomaticCanvasSize set to ‘Y’.
AbsoluteCanvasSize.Y is forced to inf, and there is nothing I can do to change it.
We have a very similar issue with AutomaticSizing we just wasted 2 hours trying to debug what was an engine bug.
We use a ScrollFrame that contains a ListLayout and various items. We update the canvas size based on the ListLayout’s AbsoluteSizeChange. The children of the ListLayout are Automatically Sized. We used to get the correct size, but now we get 0 on X size when the children of the list are automaticallySized.
This breaks the game.
We need a way to opt out of the A/B tests…
We are considering not using this feature all together and just create our own “AutomaticSizing” since this feature had bugs in the past as well.
EDIT: We solved our problems by not using AutomaticSizing
Can confirm this to be an issue for a long time already though. For me, it becomes a huge negative number or even a nan value. Is honestly really hard to debug, since it happens whenever it wants and fixes it self.
I believe the issue is that the property UIGridLayout.AbsoluteContentSize and UIGridLayout.AbsoluteCellSize doesn’t update sometimes until the GuiObject becomes visible, causing our code to receive a Vector2 of just 0s. When we update then the UIAspectRatioConstraint, the value can become nan since we divided 0 by 0. The UIGridLayout.AbsoluteCellSize becomes a nan value too.
I just modified the Y value:
Worst of all, after the UIAspectRatioConstraint has a nan value, the UIGridLayout gets totally affected to the point that you need to delete the UIAspectRatioConstraint and modify the UIGridLayout so the “Absolute” properties re-updates.
Code: (Read the comments please)
local CellSize = GridLayout.AbsoluteCellSize --> Sometimes is a Vector2 of zeros.
------------------------------------------------------------------------
if GridLayout:FindFirstChildOfClass("UIAspectRatioConstraint") == nil then
local RatioConstraint = Instance.new("UIAspectRatioConstraint")
RatioConstraint.AspectType = Enum.AspectType.ScaleWithParentSize
RatioConstraint.AspectRatio = CellSize.X/CellSize.Y --> Issue occurs here since sometimes the CellSize is a Vector2 of zeros only.
RatioConstraint.Parent = GridLayout
end
------------------------------------------------------------------------
local ContentSize = GridLayout.AbsoluteContentSize --> After the issue has happened, Y value becomes a 0.
ScrollingFrame.CanvasSize = UDim2.fromOffset(0, ContentSize.Y + CellSize.Y) --> 0 + nan = -huge number