When I’m working with an orthographic camera (doing 2D) I keep running into this issue where it would be great to know the math behind the relationship of the camera size and the units in unity space.
For example, if I know I’m in 1024x768 resolution, and my camera size is 1, and I want a mesh that completely fills up the screen exactly, how do I calculate it’s dimensions?
And if I switch to 960x640 resolution, how do I know how to adjust the camera and resize the mesh to fit the new resolution exactly? What if the camera is now size 1.2? etc.
I know there has to be some math that should be nailed to my wall that I can use to do these calculations.
The Orthographic size is the visible area from center of the screen (read: half height) to the top in unity units (1 unity unit = 1m).
So if you have a orthographic size of “1” it will show exactly 2 units height (2 meters). So if you have a standard cube (Menu GameObject > Create Other > Cube), then it will be exactly half the screen height, because the default is 1x1x1 units.
The solution isn’t scale every object in your scene, in fact is “re-size” the projection of the camera according to a specific aspect-ratio, take a look this: for me is THE SOLUTION !!!