When to use AutoScale and when to use UIAspectRatioConstraint

I’m sure a lot of you know about the plugin AutoScale Lite. I often use the “unit conversion” instead of “add constraint”.

It does scale different with unit conversion, and add constraint though, for example, something square on my device, wouldn’t be square with auto scale, but it would be square with the UIAspectRatioConstraint.

Why does this happen, and when should I use each, and what are the differences?

Thanks!

I don’t know much about UIAspectRatioConstraints, but I do know that scale is based on the player’s screen size, while offset is amount of pixels. For example, if the x value of a GUI is offset 0 and scale 1, it will be the length of the player’s screen.

I thought that UIAspectRatioConstraints did the same as using the scale size, but I think I was wrong.

I’m pretty sure the scale size does this:
If you are using offset, it sets it to size.
Not sure why a square thing on my screen wouldn’t be square somewhere else though.

Then the UIAspectRatioConstraint makes it the exact same?
I’m not too sure about that either. I used a UIAspectRatioConstraint (with the correct value) on a image, and it went all weird, but when I used it on a square button, it worked just fine.

I’m just confused on why they are different, and how the UIAspectRatioConstraint works.

UIAspectRatio should ALWAYS be used when making UI. Make sure to just have one constraint placed in the main frame, and use scale sizing on all of the other UI pieces that are descendant of that frame.
https://gyazo.com/d3ee23515829e5d60af14cfd091ccb5d

Make sure the main frame uses scale as well. Depending on the dominant axis you set it to, the ui will scale proportional to that axis, and not stretch.
https://gyazo.com/2d284028bba8074158fa3d7c8e46ccd1

and lastly the AspectRatio property describes the ratio of which to scale the ui, it is automatically set to 1 which will squish all your ui into a cube. Increase it until you get your desired result. Basically just play around with the constraint a bit. It is CRUCIAL to making proper ui in studio.

2 Likes

Weird, I set it to the correct value on an image, but it scaled strangely on other devices.

Sorry to bump the topic, but mine still isn’t working. I’ve put everything on scale, and used UIAspectRatioConstraints, but the ImageLabel I put it on just doesn’t scale at all.

I have an ImageButton inside a frame, and they are both using scale and the main frame has a UIAspectRatio constraint at the correct value. However, the ImageButton doesn’t resize at all, and the main frame resizes in the wrong direction.

Workspace:
image

I see, this is a more specific problem then. Could you show me a video / GIF of what happens when you resize the screen?

Whoops, found the issue. I was setting the size and position inside a scripting, which was making it scale strangely. Only occurred for that button though, I was setting other thing’s position and scale using a script.

I do want mine to scale in a certain direction though, could you help me out on that?
Current Behavior:
https://gyazo.com/ec4ccbb15f18ec3fb6ddef675efa30b3

Thanks!

Set the anchor point on the one to the left to be 0,0.5 and reposition it accordingly after doing that. It’s scaling upwards that way because you’ve put the anchor point at 0,0.

2 Likes