UI's the same size on every platform

On every game I’ve had, the UI’s size was always off… I want to know how to have it the same everything on every platform.

Also, what is SizeConstraint and what is it’s purpose in keeping aspect ratio?
(all XY?, parent XY?, child YY?, etc)

(here are a few images: two showing ipad vs computer size, one being the properties of my UI)



scaleOff3

1 Like

The simplest way to do this I’ve figured out is by using the UIAspectRatio constraint. It will keep your UI the same shape no matter the height or width (you choose). It’s extremely helpful and its my best friend when I’m designing UI.

4 Likes

oh wow it works! But what do these properties do?

FitWithinMaxSize vs ScaleWithParentSize?
And how can there be a dominant axis?

properties

I believe the dominant axis is what defines the value to scale to.

Say you have a frame with a size of (100,300) pixels and a desired aspect ratio of 1:1. If the dominant axis was width, the frame would resize to (100,100). If the dominant axis was height, it would resize to (300,300).

However, from my experience, I am having troubles with the DominantAxis in that it doesn’t seem to do anything. Might be a bug or mistake on my part.

1 Like

Yep dominant axis does nothing for me too

1 Like

EmeraldSlash explained the dominant axis pretty well. It doesn’t do much if your aspect ratio is 1, but if you have a 0.5 aspect ratio and your gui is in the middle half of the screen, when a user has a screen that is smaller in width for example, the gui would become smaller all around if the width was dominant. If the height was dominant, the gui wouldn’t change size because the user’s height isn’t any different. It basically depends on the guis you have around and where you anticipate needing space, but irl its not that complicated and doesn’t matter that much.

The AspectType doesn’t make sense and I don’t use it. I mess around with it if my gui element is acting weird though.

1 Like

Also should this constraint be placed in each child, or just the main Frame, to me it seems I only need to place it in the main frame and the rest goes with it. Thanks for the help!

That depends. I use it for buttons and stuff within the main frame that I want to make easily a perfect square without messing with scale values.

1 Like

Thanks for the help!