Unity New Ui Questiom

Hi guys,

I’m having a problem with Unity’s New Ui Right Now,I’m trying to make my image/button/etc… maintain the same distance between each other no matter the resolution.

Here’s an example-i literally used a ruler to measure the distance,it might not be visible here but on a large device such as a tablet it is quite visible.(Tried it on my tablet)

Note 2-720 x 1280 (mid range res)

http://s13.postimg.org/3r4eqr8zb/Note_2.png

Another Res-240 x 320(lowest possible phone res)

http://s13.postimg.org/ua5w1ti5z/Galaxy_Y.png

As you might be able to see,the distance between the buttons in the note 2 res which i designed in is the same but when the resolution changed to the lower resolution , the distance between the buttons changed.

I would like to make the distance between the buttons always stay the same no matter what res,I also want it to maintain a square shape so i ticked the preserve aspect if it makes any difference.

Anchors are positioned this way BTW:http://s30.postimg.org/709gjfrkh/Capture.png

I already looked up on canvas scaler,anchors,etc… but i dont really understand it.Thanks

Hey,

as you have probably noticed, the anchors from the “Rect Transform” component are relative. They go from min 0 to max 1 no matter what resolution. That means for a resolution of 1024x768 that x-min = 1 is 0 in pixels and x-max = 1 is 1024.

So you could for example set the min and max values to min(0) max(1) and then just use the left, right, top and bottom attributes to position them in terms of pixels.

Actually it’s always cooler to have an adapting user interface that changes when the resolution is changed. So you might better get used to the relative positioning. Afterwards you don’t have to think about for what resolution you are developing.

Also read this: Redirect to... title of new-page