UIListLayout.AbsoluteContentSize updates a frame late

The AbsoluteContentSize property of the UIListLayout object does not update until a frame after the contents within said layout are changed. This bug occurs in both Play Solo and a Test Server. Presumably this bug also occurs in online mode, but I haven’t thoroughly tested it there. The bug occurs 100% of the time. I have no info on when this bug could have first been introduced.

Repro:

Create a ScreenGui with contents similar to the sceenshot below. (Each TextButton has a size of {0, 200},{0, 50} and the Padding of the UIListLayout is set to 0, 0)

image

Contents of the LocalScript:

local F = script.Parent

F.ChildRemoved:Connect(
	function(c)
		print(F.UIListLayout.AbsoluteContentSize)
		game:GetService("RunService").Stepped:Wait()
		print(F.UIListLayout.AbsoluteContentSize)
		game:GetService("RunService").Stepped:Wait()
		print(F.UIListLayout.AbsoluteContentSize)
		game:GetService("RunService").Stepped:Wait()
		print(F.UIListLayout.AbsoluteContentSize)
	end
)

Start a server and locally delete one of the TextButton elements.

Current output:
200, 300
200, 250
200, 250
200, 250

Expected output:
200, 250
200, 250
200, 250
200, 250

Notice how in the current output, for the first frame the AbsoluteContentSize stays equal to what it was before the child was removed. Only after a frame does it update. The same behavior can be witnessed if you add an element and check the AbsoluteContentSize within a ChildAdded function. The same output also happens if you replace Stepped with Heartbeat. If you replace it with RenderStepped however it will take 2 frames to update correctly.

Also a side note, I’m not sure if this is related, but calling :GetPropertyChangedSignal(“AbsoluteContentSize”) on the UIListLayout will always pass nil to the connection.

2 Likes

@Tiffblocks has a change underway that should systemically fix all these “update late” for position/size of ui elements and layouts.

No eta on when this will ship yet, but @Tiffblocks can give you more info about what is going into the change.

3 Likes

I am working on a restructure of the GUI system internals that will fix this issue. It will also allow us to implement automatic sizing of UI elements based on their children without bugs.

4 Likes

You’re a hero!

This is still an issue and is making me work around with hacky solutions to prevent flickering :frowning:

Any ETA on this?

Edit: Oops; meant this to directed at @Tiffblocks

https://devforum.roblox.com/t/new-ui-system-backend-beta/146715

3 Likes