Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

[S] Is it possible to get the actual pixel size of a GUI which is using an UIAspectRatioConstraint?

Asked by 3 years ago
Edited 3 years ago

Hello all,

I have a bit of a wierd question, I can obviously use print(script.ViewportFrame.Size.Y) to return the properties of a GUIs Y size which are manually set/by a script BUT because I'm using an UIAspectRatioConstraint (AspectRatio = 1, AspectType = FitWithinMaxSize, DominantAxis = width) the Y size is actually limited to be of a ratio of X size.

Y = {1,0}, X = {0.33, 0} Y is limited by X so its not actually {1,0}

I hope you're following...

So, if the X size is {0.33, 0} the Y size is also limited to the aspect ratio, you might think oh then Y size = {0.33, 0} but thats not the case because this is in an oblong frame (a scrolling frame) so the scales are not the same.

Now for the question...

Can I get the actual display Y size (preferably in pixels / offset) which is a ratio of X or will the properties size of Y always be returned (like in the code of the first paragraph)?

0
Please ask for any clarification if this isn't phrased well enough :S :) AlexTheCreator 461 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

I think I have an answer:

Using ViewportFrame.AbsoluteSize.Y will give the pixel size of the GUI. This also works when the GUI has an overriding aspect ratio lock.

I took a different approach to solving my problem in the end (using GridLayouts) and stumbled across this while trying to solve a different problem!

Hopefully this helps! especially those who have upvoted (TY!)

Ad

Answer this question