I am experiencing an issue with my TextBox text not wrapping correctly (in game only) while influenced by UIScale. In this clip you can see in Studio vs In Game results. Studio is running in the device emulator as the same resolution as in game (2560x1440p), I have confirmed both UI are identical in size by printing out the UIScale value in the console (base UI is scaled with Offset, then UIScale handles resolution scaling).
System info:
Windows 10
RTX 3080
Ryzen 9 3900X
32GB DDR4 3200MHz RAM
In case it is relevant here is the code I am using to rescale the textbox parent frame:
INPUT_BAR.Input:GetPropertyChangedSignal("Text"):Connect(function()
if #INPUT_BAR.Input.Text > 200 then
INPUT_BAR.Input.Text = INPUT_BAR.Input.Text:sub(1, 200)
return
end
local TextBoundParameters = Instance.new("GetTextBoundsParams")
TextBoundParameters.Text = INPUT_BAR.Input.Text
TextBoundParameters.RichText = true
TextBoundParameters.Font = INPUT_BAR.Input.FontFace
TextBoundParameters.Size = INPUT_BAR.Input.TextSize
TextBoundParameters.Width = math.ceil((INPUT_BAR.Input.AbsoluteSize.X - 12) / INPUT_BAR.UIScale.Scale)
local Success: boolean, Size: Vector2 = pcall(TextService.GetTextBoundsAsync, TextService, TextBoundParameters)
if not Success then
-- Fallback
INPUT_BAR.Input.Font = Enum.Font.SourceSans
Size = TextService:GetTextSize(INPUT_BAR.Input.ContentText, INPUT_BAR.Input.TextSize, Enum.Font.SourceSans, MESSAGE_FRAME.AbsoluteSize / MESSAGE_FRAME.UIScale.Scale)
end
Size = math.max(24, Size.Y + 10)
INPUT_BAR.Size = UDim2.fromOffset(350, Size)
end)
Worth noting that the TextBox does have a UIPadding inside it, however removing this still results in the same issue. If needed I can provide a placefile.