I have a 2D game that takes place on a single screen. The game background is a 1920 x 1080 image. I want to adjust the orthograhpic camera’s viewport so that it precisely encapsulates the game space. Then I can adjust the screen resolution and it will always take up the entire screen. How can I do this?
I did it like this.
I got a 1920x1080 background image. Added it as UI image.
Set both main camera and image at positions 0,0,0.
Select canvas in hierarchy. Go to “Canvas” in inspector. Select “Render Mode” as “Screen Space - Camera”
Drag your Main Camera from hierarchy to “Render Camera” under Canvas’ inspector (Under Canvas again)
Go to Canvas Scaler (Script) in inspector of Canvas. Select “Scale With Screen Size”. Set Match to 0.5, and referance resolution as 1920x1080.
It’s been a long time but i hope this was helpful.