Hello developers! Put simply, the title is exactly what I am attempting to achieve. When the AutomaticCanvasSize property is set to anything other than None (XY in my case) it will automatically size the canvas of the ScrollingFrame. This is great, however, it does not update the CanvasSize property of the ScrollingFrame, meaning that I cannot get the current size of the canvas.
That is only in offsets though, correct? I have tried using it and it doesn’t scale the children correctly. Is there something I should try to make it scale properly?
if your frame isnt parented to another frame and instead is parented to a screengui, this should do it:
local Obj = Path_To_Object;
local ViewportSize = workspace.CurrentCamera.ViewportSize;
local AbsCSize = Obj.AbsoluteCanvasSize;
local OffsetX = AbsCSize.X;
local OffsetY = AbsCSize.Y;
local SizeX = OffsetX/ViewportSize.X;
local SizeY = OffsetY/ViewportSize.Y;
-- UDim would be UDim2.new(SizeX, 0, SizeY, 0)
if it is parented to a frame, this should do it:
local Obj = Path_To_Object;
local AbsCSize = Obj.AbsoluteCanvasSize;
local ScaleX = AbsCSize.X/Obj.Parent.AbsoluteSize.X;
local ScaleY = AbsCSize.Y/Obj.Parent.AbsoluteSize.Y;
-- UDim would be UDim2.new(SizeX, 0, SizeY, 0)
never really worked with ScrollingFrames CanvasSize, so neither might work, if thats the case just keep waiting for an answer or search online
Thank you! This has worked for the most part. It still struggles with maintaining the original size of the children, however, it has worked for scaling the CanvasSize.