GUI Size via Scale results in Incorrect Size

Reproduction Steps
Repro: Size Issue - Roblox
Size Issue.rbxl (42.8 KB)

(Run in play solo test mode to see the issue)

This is a reduction of code/UI I’m using in a project.
There is code which resizes an inner container relative to the size of an outer container.
The contents of the inner container with size set to UDim2.new(1, 0, 0, 100) displays incorrectly such that it takes up less than 100% of the width of the container.
It was working fine last week and over the weekend until some point yesterday, and I didn’t make any code changes to this area of the code since. My code doesn’t touch the sizes of the inner contents so shouldn’t be an issue.

I’m not sure what is exactly causing this issue but I think it might be when a parent frame is resized while a child frame has Visible set to false. In the demonstration you will see the first prompt while resizing happens is fine, it being the latter ones which are affected.

Interestingly the Frame with the same parent, has X Scale set to 1 too, and is fine.

System Information: Windows 10 Desktop, AMD A10-5700, 16GB RAM, NVIDIA GeForce GT 1030.

Expected Behavior
I expect the TextLabel to take up 100% of the width of the parent.

Actual Behavior

The TextLabel is only taking up some of the space of the child container, I think it might be the total size before the parent size was changed but am not 100% sure on this.

Issue Area: Engine
Issue Type: Display
Impact: High
Frequency: Constantly
Date First Experienced: 2021-07-26 14:07:00 (+01:00)
Date Last Experienced: 2021-07-27 20:07:00 (+01:00)

18 Likes

This is probably a studio bug, never seen this in-game. Resizing any of the widgets that consequently resize the canvas would fix the problem (probably spaghetti code not updating the UI):


This issue is also prevalent when you’re not playtesting, though less frequent (this issue could be solved by switching on and off the emulator).

2 Likes

Can confirm this happens to me, however turning it invisible and back visible seems to fix it for me.

In the last few hours, we’ve had 8 reports of issues in our live game that sound very similar to this. People saying that the text scaling is broken until they resize their game window.

In both of the examples, there’s a child element which should take up 100% of the height and width of the parent.

I will look into it to see if there’s an issue on our end, but I want to share now in case it’s helpful for an investigation.

2 Likes

I’m getting it in-game if you look at the place I linked.

I noticed the nudge resize too but forgot to mention in my rewritten report (wrote the bug report, went back a page to review the title and lost all my report: nightmare).

Seems there are various work arounds which are good. The project I’m working for isn’t aiming for release until September so hopefully a fix is applied before then!

I’ve created another project which reproduces the issue here.

  1. Hide a gui element which has a child with a size set to {1,0,1,0}
  2. Resize the Roblox window.
  3. Show the gui element. The child will be incorrectly sized.

If you then resize the window while the frame is visible, everything is resized correctly.

Here it is in Gif form:

Do people have a way to workaround this or do we need to wait on a fix from Roblox?

3 Likes

I can confirm that the bug is caused when the size is adjusted while the parent is invisible. This code causes the bug every time. (The problem is not unique to text objects, all GuiObjects have the same problem)

parent.Visible = false
child.Size = UDim2.new(1, 0, 1, 0)
wait()
parent.Visible = true
5 Likes

Thanks the report! We have filed a ticket and are looking into this.

7 Likes

Is there any fix? When it happens on mobile devices nothing can be done about it since the window size can’t be adjusted.

2 Likes

I can confirm this bug affects studio too, there is no need to start the game.

Changing the size while visible, fixes the descendants.

1 Like

Hey everyone, A ghetto fix (lol) I found that works is detecting when a gui instance becomes visible and changing the clipsdescendants property back and forth - this trick works with other properties as well but I chose clipdescendants:

local function FixSizingBug(GuiInstance)
	if (GuiInstance:IsA("GuiObject")) then
		local function OnVisibilityChanged()
			local IsClipsDescendantsEnabled = GuiInstance.ClipsDescendants
				
			GuiInstance.ClipsDescendants = not IsClipsDescendantsEnabled
			GuiInstance.ClipsDescendants = IsClipsDescendantsEnabled
		end
		
		GuiInstance:GetPropertyChangedSignal("Visible"):Connect(OnVisibilityChanged)
		OnVisibilityChanged()
	end
end

for _, Child in ipairs(MainGui:GetChildren()) do
	FixSizingBug(Child)
end

MainGui.ChildAdded:Connect(FixSizingBug)
--MainGui is a screen gui containing all of the gui instances
3 Likes

This bug appears to be fixed! Not sure how since a didn’t see a new version of studio come out, but I can’t reproduce anymore.

Still an issue for me


Can confirm this is happening to me too. I’ve recently been reopening my project to find that GUI elements size via scale appear far differently than how they are supposed to.


The bug is demonstrated in the first screenshot - the size of the play button is of scale {0.262,0.211} and appears almost invisible while the second screenshot shows the result of me after creating a brand new default frame instance into the ScreenGui in which all of the tiny elements were parented to. Just by inserting the frame - All GUI buttons displayed the correct size and scaled correctly. It is indeed still occurring across multiple games and has not been resolved.

Note that this issue has been present in both my original projects and team create group games to this day.

I’m having the same bug / problem but instead, with my UI instance being created by a script, at first it’s scaled at almost the minimum size when joining until screen is resized which updates the size to what it should be.

This applies for both Roblox studio and Roblox client.

Just experienced this bug as well and I noticed it happening on a new frame that I inserted into my game. I can’t seem to get it to go away and it’s very annoying because I’m not able to push an update to one of my games because of this since it cuts off the entire GUI.

I’ve recently started to experience this bug in-game and in-studio. It’s solved by resizing the window, but incredibly confusing for users. Can’t seem to find any workaround.

1 Like

The same things happens to me


1 Like

I have just experienced this bug, but unlike other suggestions in this post, resizing the window does not fix it for me.

Hi,
I have this problem too, this is happening in my game for almost 2 months.

I think that it is happening only to things that are not visible when the game starts and if you will change something like size, position, transparency etc. it will get fixed, but for some reason i cannot fix it by script.

evidence:

1 Like