Download

How to set up correct orthographic camera aspect ratio

Hello everyone! Forgive me in advance for my bad English (i use google translate for some words :D)

I make a mobile 2d match3 game and this is how I set up the playing space (first screen in attachments):

  1. I have background image (it’s a widget and plugin “Image Plate” for my orthographic camera)
  2. I have tiles (planes with some material at z=10 coordinates
  3. i have gems (planes with some material at z=12 coordinates)
  4. i have orthographic camera above that stuff

And i have a problem. I dont know how to detect device aspect ratio and change it in camera settings.
I set the value to 16:9 (0.5625) and the result in the second screenshot (black bars) on the phone with an aspect ratio of 19:9. How do I know which aspect ratio to set for the camera so that the background image and other ui elements take the appropriate format and fill the screen?

Thanks to all! :slight_smile: