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)
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.