Camera and UI settings for aspect ratio independent 2D game

Dear Community,

I recently started getting familiar with Unity and I am trying to port my half-finished 2D game from Monogame to Unity. I got a bit stuck at the proper camera and Image set up.

What I would like to achieve is a resolution and aspect ratio independent game. The virtual resolution I am using is 1920x1200. At the moment everything looks fine at this 16:10 aspect ratio. I downloaded a script that I added to my camera:

I changed the hard-coded values to public variables, so I can use them in the editor.

My camera is set to be ortographic, the canvas of the UI Image is set to use my above mentioned virtual resolution, but something is still wrong, because when I run the game I can still see the black widescreen areas above and below, or on both sides of the screen (depending on which resolution I chose from the popup settings).

My question is rather general and not related to my current problems:
How do I need to set up a UI elements-only game’s :

  1. camera (ortographic, persepctive? fov? etc…)?
  2. UI elements and their canvas (I’d rather not use the anchors because the positions and sizes should be scaled down or up depending on the actual resolution - virtual resolution difference)?

( 3. extra: As I am creating prefabs from buttons and text inputs because I have custom images appearing on them (disabled image, mouseover image, pressed image, …), can I use one canvas for all of my controls, or do I need to create a canvas for each control? Any performance problems when using multiple canvases? Will the canvas size affect my controls in any ways?)

Thank you in advance and my apology for these beginner questions! Tried as I might have, I could not find answers though I spent my last 3 days on searching for then. :slight_smile:

Ok, basically this video tells you how to change the anchors, pivot and basically everything to be able to give your UI elements an aspect ratio and resolution-free look:

It's not easy, and at the moment I am not sure how to properly do this when I create the prefabs for controls appearing multiple times at different positions on the screen, but hopefully it will not be a big problem.