ScrollingFrame.AutomaticCanvasSize not working with UIListLayout and/or AutomaticSized Children

I’m trying to make a menu with a UIListLayout. (Attached: AutomaticCanvasSizeExample.rbxm) The ScrollingFrame’s AutomaticCanvasSize will only set itself to the WindowSize instead of taking into account its children’s AbsoluteSizing and AbsolutePositioning, resulting in no scrollbar whatsoever. (Attached: IMG1,IMG2, IMG3)

If I remove the UIListLayout and adjusts the children’s positioning manually, the scrolling frame works as intended but STILL does not take into account the AbsoluteSize of its children, resulting in the ScrollingFrame’s CanvasSize not being tall enough to show the last child frame in the order. (Attached: IMG4)

If I had to guess where the issue lies, I would think that it mainly roots from ScrollingFrame.AutomaticCanvasSize not calculating based on AbsoluteSize/AbsolutePosition and instead calculates on children Positioning/Size. (Which ends up being 0 for both AutomaticSized GuiObjects and GuiObjects positioned by UIListLayout.)

If I had to suggest a solution to the CanvasSize issue, it should be calculating based on it’s children’s AbsolutePositioning and AbsoluteSize.
And for the issue of CanvasSize with UIListConstraints, it should be calculating the CanvasSize based off of the UIListLayout.AbsoluteContentSize X/Y depending on the selected AutomaticCanvasSize Axis.





AutomaticCanvasSizeExample.rbxm (13.4 KB)

19 Likes

Thanks for the report! We’ve filed a ticket to our internal database, and we’ll follow up when we have an update for you.

5 Likes

Similar issue, AutomaticSize is not respecting UIPadding and content size.

6 Likes

Whoops, I initially made this as a DM since I couldn’t post to Studio Bugs. I didn’t know that this DM would get turned into a thread. That’s pretty neat though.

Since I determined it was a studio bug, I’ve just been using a quick/easy workaround and thought I should share it for anyone else having this specific issue of ScrollingFrames not adjusting AutomaticCanvasSize properly with UILayouts/UIPadding.

local AllChildren = ScreenGUI:GetDescendants()
for i,v in pairs (AllChildren) do 
	if v:IsA("ScrollingFrame") then 
		if v:FindFirstChildOfClass("UIListLayout") or v:FindFirstChildOfClass("UIGridLayout")then
			local Layout = v:FindFirstChildOfClass("UIListLayout") or v:FindFirstChildOfClass("UIGridLayout")
			local function UpdateSize(FrameInstance,LayoutInstance)
				if FrameInstance and LayoutInstance then
					local PaddingX = 0
					local PaddingY = 0
					if FrameInstance:FindFirstChildOfClass("UIPadding") then
						local UIPadding = FrameInstance:FindFirstChildOfClass("UIPadding")
						PaddingX += UIPadding.PaddingLeft.Offset
						PaddingX += UIPadding.PaddingRight.Offset
						PaddingY += UIPadding.PaddingBottom.Offset
						PaddingY += UIPadding.PaddingTop.Offset
					end
					if FrameInstance.AutomaticCanvasSize == Enum.AutomaticSize.Y then
						FrameInstance.CanvasSize = UDim2.new(0,0,0,LayoutInstance.AbsoluteContentSize.Y + PaddingY)
					elseif FrameInstance.AutomaticCanvasSize == Enum.AutomaticSize.X then
						FrameInstance.CanvasSize = UDim2.new(0,LayoutInstance.AbsoluteContentSize.X + PaddingX,0,0)
					elseif FrameInstance.AutomaticCanvasSize == Enum.AutomaticSize.XY then
						FrameInstance.CanvasSize = UDim2.new(0,LayoutInstance.AbsoluteContentSize.X + PaddingX,0,LayoutInstance.AbsoluteContentSize.Y + PaddingY)
					end
				end
			end
			UpdateSize(v,Layout)
			Layout.Changed:connect(function() UpdateSize(v,Layout) end)
			v:GetPropertyChangedSignal("AutomaticCanvasSize"):connect(function() UpdateSize(v,Layout) end)
		end
	end
end

If you’re having the issue of ScrollingFrames AutomaticCanvasSize not calculating correctly with AutomaticSized descendants, I’ve found the only solution is to calculate the AbsoluteContentSize of all the ScrollingFrame’s children.
You could create a script to automatically calculate the AbsoluteContentSize by comparing AbsolutePositions and AbsoluteSizes between all of its children (which would be relatively straight forward but could be especially hard if you have any positional spacing since the spacing would need to be compared against each child’s AbsoluteSize/AbsolutePosition and could even require annoying conversions if using a mixture of scales and offsets).
I decided not to make that AbsoluteContentSize calculator since it would be very tedious to write and it’s much easier to just grab the already calculated AbsoluteContentSize from a UILayout with the script I posted above. But unfortunately that solution isn’t going to work for you if your use-case doesn’t utilize UILayouts.
You always could do some simple addition/multiplication if you know that the scrolling frame’s children aren’t going to be changing position and/or size but that would defeat the point of using AutomaticCanvasSize since you would end up setting it manually lol.

7 Likes

This bug is STILL an issue that hasn’t been fixed, making this property still borderline useless, since in a ton of use cases where this property shines involves using it in conjunction with a UIListLayout, UIGridLayout, etc.

This same bug report, posted a year ago (AutomaticCanvasSize is borderline useless in its current state) in which they said a “high priority ticket” has been filed, has not resulted in this bug being fixed after a full year.

This is still severely impacting my UI workflow and adds to the list of the flaws that the current UI system has, which has made me spend more time than I need to to research and implement a workaround. I, and a lot of other developers would love an update on this and a fix to end this issue once and for all.

23 Likes

For myself, AutomaticCanvasSize with UIListLayout works about 90% of the time, but for the other 10%, the scroll bar will not be there. This is extremely annoying and destroys the entire usage of this property. In any other situation, I would just hardcode the scale/offset of the frame. This is ONLY useful with UIConstraints, and those are what it doesn’t work with.

Every developer who works with UI that I know has been complaining about this bug. It has been over a year since this was reported. Where is a fix? This must be impacting loads of games.

5 Likes

This is a really important issue and hasn’t been fixed yet, not only does using scale/offset determine changes but uilistlayout padding is not supported!

3 Likes

I don’t want to be the one to necro a thread, but this issue is still prevalent and very irritating.

3 Likes

The engineers will start fixing this issue as soon as possible!

Thank you for your patience!

7 Likes

Glad to know you are working on it, because this bug is extremely annoying. I pretty much always use a UIListLayout with a ScrollingFrame, hence why I resort to creating my own function to size the canvas because AutomaticCanvasSize is not compatible with UIListLayouts.

1 Like

Any update on when this will be fixed? I’ve noticed that this is still an ongoing issue.

1 Like

Hi @Ty_Harukii

The issue has been fixed, we just need to turn on a flag which will be in the next update or much sooner!

5 Likes

Has this update been rolled out?

If so, I haven’t noticed any different behavior with UIListLayouts.

Here are some screenshots from the latest studio version using the AutomaticCanvasSizeExample.rbxm from the original post.

Click to view screenshots

UIListLayout :no_entry_sign:

Screenshot_4230

1 Like

Not yet unfortunately!

It should have come out already, but some more complex issues came across that our team needs to handle currently, so they don’t interfere with the fix!

I will let you know here as soon as the fix will be shipped!

12 Likes

Hi focia, Any update on this, because I’m having severe issues with Automatic size not working in any shape or form

2 Likes

Hey, its now May 18th, will you guys fix this problem or not cause I’m still experiencing it in my game.

1 Like

Facing issues that might be related to this bug as well, using AutomaticCanvasSize, UIGridLayout (works with offset but not scale CellSize, scale completely breaks it) and UIPadding.

Edit: Fixed my issues by ditching UIPadding completely and instead using a Frame with Position and Size to emulate the padding behavior, which works for me.

Not entirely sure if this bug correlates with the issues I came across anymore.

And the issue once again, returns.
Seems like the CanvasSize doesn’t get updated if you use AutomaticCanvasSize combined with UIPadding or a Frame that uses Scale for positioning or padding (think Y padding).

3 Likes

This is still a very frustrating issue!!! And also when the auto size does work it does not account for UIPadding

3 Likes

Putting an image label into a frame breaks the scroll wheel…

I have a scrolling frame with a UiListLayout and 4 frames inside. The first 3 frames have image labels inside of them. As soon as I put an image label onto the fourth frame the scroll wheel disappears and doesn’t work anymore. Shown below:

4th frame is without an image label and the scroll wheel is visible and working
image

4th frame with an image label and the scrolling wheel disappears and not working

image

4 Likes

Yeah, you are right! It really was an issue of UIScale I’d used during testing so I could better see the GUI. But I want to use UIScale in normal use too and if it breaks scrolling, it is really frustrating.

What’s more, even CanvasSize is broken when UIScale is applied.
I’ve made a simple function to fix AutomaticCanvassize:

local Absolute = Menu:FindFirstChildWhichIsA("UIListLayout").AbsoluteContentSize
Menu.CanvasSize = UDim2.new(0, Absolute.X, 0, Absolute.Y)

But again, the actual CanvasSize is multiplied with UIScale.Scale. You can see that when you just use Menu.CanvasSize = UDim2.new(0, 0, 0, 50) and if the Menu is inside an object with UIScale, Menu.AbsoluteCanvasSize is equal to UDim2.new(0, 0, 0, 50 * UIScale.Scale). Whyyy :sob:

2 Likes