0
\$\begingroup\$

I don't have a GUI or anything. Just a bunch of game objects with pictures on them.

I want everything to scale with the size of the screen. So if it's a small screen, the character will take up less of the screen, instead of the screen just cutting off at the edges. If the screen is larger, everything is larger.

Is this something I should do? Will Unity automatically do this?

I've been told that the project should have the following specifications:

"The app should be appropriately scaled to fit the device screen to avoid letterboxing"

Use bg.png as the background of the app. Ideally, the background should be centered to the app such that the left and right edges go off the screen if the device aspect ratio is less than 16:9.

Is what I'm describing fitting the specifications here? What will Unity do for me? I don't have a phone to actually test this on so I don't know what the app will end up looking like.

\$\endgroup\$
  • \$\begingroup\$ Do the game objects need to be in 3d? Perhaps using the legacy gui system might be best if you want to control the position and size of the given bg.png (the simplest that I can think of at least); The downside to which would be that it would be displaying the bg.png in 2d - but it could easily be set to a given size in pixels (and won't change size simply because the screen is larger or smaller) and with minimal logic you can get it to match the requirements that you listed. \$\endgroup\$ – return true Jan 30 '15 at 23:00
1
\$\begingroup\$

Unity will try to scale things up/down to fit the current screen. So yes, your object will take less space in a smaller screen. However, the scaling will not always be perfect.

For instance, the iPhone 5, 6 and 6 Plus all have the same ratio. So if you develop for any of them, the game will seamlessly scale and fit perfectly the screens. However, the iPad Mini devices for example do not have the same ratios as the iPhones. In fact, you will notice that the sides (if you're working on landscape) will be cut a bit.

So really the first thing you should consider is what devices will you support, and then find out their resolution ratios. Then design your background/interface stuff with that in mind.

\$\endgroup\$
1
\$\begingroup\$

im quite new to using unity too. But i see in the 'Game' preview window, you can select the exact screen size. I'm not sure if this sets a Fixed Viewport or not once it is finally built for iPhone etc but it does seem to give you the fixed viewport in the preview so i assume that it would also one the build for each device type

\$\endgroup\$
  • 1
    \$\begingroup\$ Yes, by default Unity will take the height of your 3D camera (thay's vertical field of view for perspective cameras, or vertical size for orthographic) and scale it to fit the vertical dimension of your screen in its orientation (or your current render target / rect viewport if you're using either of these). The horizontal axis will scale in proportion to this vertical scale — which means the cropping left to right can change with the aspect ratio of the screen. You can change these behaviours with scripts if you need. \$\endgroup\$ – DMGregory Jul 15 '17 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.