0
\$\begingroup\$

I have the following circle laid out where I'd like it at 1920x1080: https://i.sstatic.net/zxrfE.jpg at 1280x720 it takes the same amount of relative screen space.

When the aspect ratio changes I want the circle to remain a circle and for it to always be top right aligned.

When I set the image to preserve aspect it gets pushed downwards like so: https://i.sstatic.net/18deg.png

How can I ensure the image stays top right aligned in all cases?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

You need to use anchors and pivot to set the position relative to screen space (also, the UI object needs to be a child of the Screen Space Canvas).

In this picture, Main Camera is the camera I'm using for the viewer. Scripter is a UI Canvas with Screen Space as the camera option. The button is relative to that canvas and will always stay relative to it. If the UI is too big for the screen, I suggest using a Canvas Scaler (can be seen in the link at the bottom).

enter image description here

Scripter canvas object's inspector screen.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ ah 'canvas scaler' was the missing secret sauce. I totally forgot about that. Thanks! \$\endgroup\$
    – meds
    Dec 16, 2016 at 12:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .