Screen cut off on iPhone 4 when using orthographic camera
I have been working on a 2D iPhone game. I'm testing it on a iPhone 5 aspect ratio, but since the iPhone 4 is using a different aspect ratio this is what happens:
This is the iPhone 5 screen:
And this is the iPhone 4 screen:
as you can see with some levels this isn't really a problem but what is the best way to make the camera fit the screen just like the iPhone 5?
Thanks in advance!
-Lars
Answer by metars · Dec 04, 2015 at 11:04 AM
hi > Uktol
you can change camera size your aspect value, may be it's work
eq:
void Update()
{
float aspect = Camera.main.aspect;
if (aspect == 1.5f) //3:2 ratio landscape
{
Camera.main.orthographicSize=3.0f;
}
}
Assing script main camera
/*
screen ratio calculating
ratio 3:2 (3 / 2 = 1,5 aspect value)
ratio 16:10 (16/10=1,6 aspect value)
*/
Your answer
![](https://koobas.hobune.stream/wayback/20220612051245im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Using two cameras to blend regular 2D orthographic with 3D isometric orthographic elements 0 Answers
Fit app for all mobile screen sizes 0 Answers
How to zoom out orthographic camera so that the parts that aren't UI blocked remain the same. 1 Answer
3D objects appear behind 2D on mobile, but in correct order in editor 1 Answer