I bought a complete mobile project from Unity asset store. I opened the project and checked the Camera Size (which was main reason for buying a project). The camera size is set to 5.8. So, as per my understanding, this size is for a height of 580x2=1160px. However, changing the resolution in game view doesn’t change the height.Only width. I deployed it on a 320x480 android phone and it looks ok with only the sides cropped. But why is there no cropping on top and bottom? target height is 1160 and my device height is 480.
Please help me understand this. Thanks.
Orthographic size means how many units in world space the viewport half height is. So when you set Orthographic size to 5.8, it simply means that for example a cube placed at coordinates (0f, 5.8f) has it’s pivot point aligned with the top of the screen (bottom half of it should be visible because the pivot is in the middle by default)
The camera will always show that same amount of world units on the screen height-wise regardless of resolution. So if you look at the game on a 200x100 pixel screen, Unity will try to render exactly the same part of the game world on the screen with a 400x200 screen. The picture will just be more detailed because the device has a better resolution.
Depending on the device’s screen aspect ratio, the visible world area WIDTH can change and can be calculated based on the orthographic size and device resolution
float screenHeightInUnits = Camera.main.orthographicSize * 2;
float screenWidthInUnits = screenHeightInUnits * Screen.width/ Screen.height; // basically height * screen aspect ratio