0
\$\begingroup\$

I want my 2D game to be playable (auto scale) in all screen resolution. I'm using Cinemachine & under "perspective" mode. I found tutorial to change the screen in "orthographic" mode but there is no answer for "perspective" mode using Cinemachine. Please help on what setting must be done in Cinemachine or if there is any scripting that I can use. Thanks a lot.

NB: I tried to add a script as in below link. But it doesn't work. Perhaps it's because I'm using Cinemachine instead of normal main camera. Link: Scale camera to fit screen size unity

enter image description here

Edit: Added picture of the "perfect" view I want below. I use 1280x720

Image "expanded" to left & right when I change to "free aspect" enter image description here

\$\endgroup\$
  • \$\begingroup\$ Your game will play on any mobile screen as is. The trouble is that it might not look the way you want it to. In order to help you solve that, we need you to define what you want it to look like on each resolution. Try showing us a screenshot of your game at your main supported resolution. If it contains details you can't share publicly yet, make a mock-up with just coloured cubes or placeholder sprites to convey the same kind of layout. Then try changing the resolution, and playing with the camera until it shows what you want it to look like in that version — what changes? \$\endgroup\$ – DMGregory Aug 19 at 11:47
  • \$\begingroup\$ Apologize for the unclear question. I'm a newbie in gamdev world. I added the picture of the perfect view that I want (i'm using 1280x720). Game content is either being "cut" left or right or "expanded" when I change the resolution. I want the view exactly the same with 1280x720 res, not "expanded" or "cut". \$\endgroup\$ – Min Aug 21 at 7:31
  • \$\begingroup\$ You can't have exactly the same view. When you change from a tall and skinny view to a squatter, wider view, the same shape of image no longer fits. So you have three main choices: add padding (pillarboxes) to fill the new empty space, show more of your image at the left & right (default), or show less of your image at the top & bottom. You can also do a compromise between these strategies, adding a little padding / widening the side-to-side view a little / shrinking the top-to-bottom a little all at once. Try using a paint program to show what you want the game to look like in that 2nd shape \$\endgroup\$ – DMGregory Aug 21 at 11:12

Your Answer

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

Browse other questions tagged or ask your own question.