1
\$\begingroup\$

I'm complately new to Unity, but I know what's going on, I've made some games with LibGDX earlier.

In GDX, to handle all resolutions perfectly I always create 5 different sets of backgrounds (cause they have to be perfectly sized) and I place UI widgets on percentage for each ratio independantly (hardcoded values). I was just checking what's the ratio on runtime.

As we know, there are only 5 possible aspect ratios for mobile devices (I target mobile only).

Now, when I started using Unity, the first thing I looked up was how devs handle ratios. I found some scripts in the web, which add pillarboxes which in my case is unacceptable.

So I thought - ok, let's do it my way, and make it for all aspect ratios.

And my question is:

Is there any option in Unity, which will allow me to 'switch' in the Unity Editor between ratios and the 'Scene View' will understand this and resize?

What I want to do is to create a 16:9 with the editor, then switch to 5:3, adjust elements for it, and remaining ratios too.

To be clear, I don't mean the 'preview', when you check the desired device and it shows how the game will look like.

Any help and tips are appreciated! :)

\$\endgroup\$
1
  • \$\begingroup\$ But changing the resolution/aspect ratio in the game view will register in the scene view and the canvas will resize. \$\endgroup\$
    – Uri Popov
    Commented Dec 21, 2016 at 21:58

1 Answer 1

2
\$\begingroup\$

As Uri Popov notes in the comment above, this is done via the Game window rather than the Scene window itself.

Just beside the display selector at the top of the Game window, you'll see a drop-down menu that lets you select different aspect ratios or fixed resolutions. By clicking on the "+" at the bottom of the menu, you can add your own custom versions.

Screenshot of Unity Editor showing resolution controls in Game View.

Changing your settings here (or resizing the window, if using a non-fixed resolution) will feed back into your Camera and UI Canvas objects in the scene, and you'll see them / their gizmos rearrange and reshape themselves accordingly.

This lets you tune your layout for multiple different resolutions in-editor, without necessarily needing to run to check the results each time you change something.

\$\endgroup\$
1
  • \$\begingroup\$ Aww, didn't know that this will affect the canvas itself. Thanks sir! By the way, I have one more question here. As I posted above, i need to load 5 sets of backgrounds. Is there any way that Unity will switch these graphics when changing the ratio in the Game View as you shown? \$\endgroup\$
    – Jacob
    Commented Dec 22, 2016 at 7:18

You must log in to answer this question.

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