I encountered a strange “ScrollingFrame” optimization.
In short, “UIListLayout” is very strange.
My code:
local scrollingFrame = ScrollUi
local UIListLayout = scrollingFrame.UIListLayout
scrollingFrame.CanvasSize = UDim2.new(0, UIListLayout.AbsoluteContentSize.Y, UIListLayout.AbsoluteContentSize.X ) -- This makes sure the scrolling frame is scaled when the game starts.
local function onContentSizeChanged()
print("Debug1")
scrollingFrame.CanvasSize = UDim2.new(0, UIListLayout.AbsoluteContentSize.Y, UIListLayout.AbsoluteContentSize.X ) -- This makes sure the scrolling frame is scaled when ever there is something added into it during the game.
end
UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(onContentSizeChanged)
if someone can solve this problem that was very good
Remove the scaling in the script. If you size it to {1, 0}{1, 0} and resize from there, it should scale automatically. Alternatively, just make sure the size is 1 or less (e.g. 0.634, 0)
Do this for all the descendants of the ScrollingFrame (obviously ignore the UIListLayout, etc.)
Basically, for the scrolling frame itself, and everything in it that has a Size property, make sure the size is less than or equal to 1. This will automatically scale it for all devices.