AutomaticSize not updating when object is set to be visible

Sorry for the inconvenience, we are currently working to fully resolve this issue.

3 Likes

Was working on a small info GUI for a community place and ran into this bug and found this post.

First, a few things I noticed not noted in the past posts that might be helpful:

  • If you update the GUI object so the scaling fixes itself, the scaling will be correct even if you then make the GUI invisible again and toggle it back, until the player resets.
  • The GUI elements can still correct themselves if the player changes their window size, though not always (wasn’t really able to figure out why it worked sometimes on all elements, and sometimes one would remain missized)
  • The same issue seemed to happen in studio sometimes too? I’d occasionally have to re-parent the GUIs to where they were supposed to be for them to adjust their size, but it wasn’t consistently happening enough for me to notice any real pattern.
  • AutomaticSize elements seem to freak out and miscalculate to be way too big when put onto a scrolling frame.

And then finally, my quick fix for any devs being affected by the problem, a small function resizing the direction that is set to automatic from 0 to 1 whenever that part of the GUI becomes visible is a fairly quick and easy solution, albeit not very elegant. Might also not be too practical with some of the more complexly structured GUIs people make.

[Edit: I should note this doesn’t work for the AutomaticCanvasSize problem also mentioned, but toggling it on and off works for it]

The issue with AutomaticCanvasSize mentioned above is still happening even today, I hope you guys fix it soon.

1 Like

Hi @Unity_456 , the fix is already in testing, hopefully we will have an update soon.

10 Likes

AutomaticSize is still bugging out

In this case I’m setting the frame to be visible then changing the size to Udim2.new(0, 1, 0, 1) to force it to update. Before it worked fine but recently it has become broken again…

2 Likes

This feature (AutomaticSize) also does not work properly with RichText enabled…

2 Likes

AutomaticSize doesn’t work too, I have to set it to None, then set it to X again for it to refresh

1 Like

I’ve been having this issue for months, and I have just seen this forum post. When is this going to be fixed? It’s still affecting many games including mine.

4 Likes

Please provide us with an update. This is supposed to be a live, fully-functioning feature—it’s been broken for months (if you dare set your guis Visible property…)

3 Likes

I’m also still experiencing this issue with AutomaticSize.

1 Like

It appears to work just fine when you use pixels, just not with scale.
It would be nice to have it so the scale was consistent with the size of the actual viewable frame when it expanded, and for it to work with scale, as right now with scale, even if you use tricks to make the elements the same height when the canvas gets bigger, it still runs the elements off the canvas then eventually they resize.
Hopefully this will be fixed soon.

Why is this still not fixed? Any updates @CharlieGordonnn?

This is still a major issue for me. I created this hacky fix to temporarily solve the issue while only slightly affecting the most observant users. The hack works by increasing the size by 1 pixel for 2 frames, every time that the object becomes visible.

This code is modified based on @RemoDunks hack in this thread for another similar issue.

local rs = game:GetService("RunService")
local function FixSizingBug(inst)
    if inst:IsA("GuiObject") then
        local function OnVisibilityChanged()
            if inst.Visible then
                -- use UISizeConstraint to not mess with any tweens
                local resizer = Instance.new("UISizeConstraint")
                resizer.MaxSize = Vector2.new(math.ceil(inst.AbsoluteSize.X) + 1, math.ceil(inst.AbsoluteSize.Y) + 1)
                resizer.MinSize = resizer.MaxSize
                resizer.Parent = inst

                -- for some reason it takes 2 frames to take effect
                rs.RenderStepped:Wait()
                rs.RenderStepped:Wait()

                resizer:Destroy()
            end
        end

        inst:GetPropertyChangedSignal("Visible"):Connect(OnVisibilityChanged)
    end
end

local function FixGui(gui)
    if gui:IsA("ScreenGui") then -- feel free to listen in workspace for SurfaceGui and BillboardGui
        gui.DescendantAdded:Connect(FixSizingBug)
        for i, v in pairs(gui:GetDescendants()) do
            FixSizingBug(v)
        end
    end
end

game.Players.LocalPlayer:WaitForChild("PlayerGui").ChildAdded:Connect(FixGui)
for i,v in pairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do
    FixGui(v)
end

Hi @royee354 , thanks for following-up on this. We have been actively looking into this issue. But the change has also been causing a series of regressions since it touches some basic functions. We are now trying to finalize the fix in a few weeks. Sorry about the delay and we appreciate your patience!

7 Likes

As of 2021-09-16T16:22:37Z, the FFlag UpdateAutomaticSizeWhenSetVisible5 was set to True, which seems to have fixed the bug.

This basic demonstration shows that disabling/enabling the visibility changes the size of the parent container:

3 Likes

Our currency labels use AutomaticSize and have broken today. Readjusting the window snaps them back into the correct size.

1 Like


same issue, labels are being crunched down because of this

I know its an old thread but I just fixed this with this script in the frame:

local frame = script.Parent.List

local layout = frame:FindFirstChildWhichIsA(“UIGridStyleLayout”)

local absoluteContentSize = layout.AbsoluteContentSize

frame.CanvasSize = UDim2.new(0, 0, 0, absoluteContentSize.Y)

layout:GetPropertyChangedSignal(“AbsoluteContentSize”):Connect(function()

local absoluteContentSize = layout.AbsoluteContentSize

frame.CanvasSize = UDim2.new(0, 0, 0, absoluteContentSize.Y)

end)

Unfortunately it’s still not fixed in my game.

Could we get an update on this? The issue is still not fixed.