How to set constant orthographic viewport?

I’ve been experimenting with 2D game project in Unity and started a very simple pong game to get acquainted with unity but I’m having a difficult time grasping the concept of the orthographic camera.

When I click on the orthographic camera, it has values of [0, 0, -10] for the XYZ values. I’ve been reading up on the orthographic size and how the camera viewport height seems to correspond to 2 * Camera.OrthographicSize. I’ve set the size to 40 and I’ve put top and bottom wall sprites at -40 and +40. So far so good.

I’ve also read how the Viewport width corresponds to Viewport Height * Aspect Ratio, except that I have no idea what the default aspect ratio for the game is at this point. This is problem #1.

From eyeballing the camera viewport width, it seems to be at about -60 and +60, indicating an aspect ratio of 3:2. Okay I guess…

sigh, I just want to be able to set my camera viewport at a certain size, say 320x240, use my sprite set of consisting of 16x16 sprites, and visually design the UI by dragging in the sprites to the appropriate places on the Scene; ideally I’d be able to set a Snap Grid (like Photoshop) and lay everything where it is supposed to be.

Then when people play the game, they can pick from a set of resolutions (320x240, 640x480, 800x600, etc) but the game just upscales the output from the original 320x240 resolution, so that internally (in code and scene designer) I only have to deal with a single defined resolution.

There’s quite a lot of similar questions on UA, and the first problem is that people don’t usually realize this is a design question first and a programming problem only after that.

You simply can’t make a game “look the same” on two devices that have different aspect ratios. So unless you have total control over the resolution of the target device (only desktop version & only windowed mode, or a very strictly limited set of mobile devices), you’ll have to compromise either by

  1. having black bars on the sides or top and bottom of screen
  2. resizing camera to crop the content by height or width
  3. scaling only x or only y of the content to fit the screen perfectly, but losing the proportions of your game world in the process

You don’t specifically mention if or how you have solved the design problem. If you do have total control of the resolution so that the aspect never changes, the orthographic camera already does all the work for you. If you don’t, you can

  1. Investigate the black bars solution
  2. Change the camera size with the same principle as above (I believe multiplying/dividing your original orthographicSize with float scaleheight will crop the image by height or width depending which you want
  3. why would anyone want to do this…