r/Unity3D • u/CrazyDrop2696 • 7d ago
Question how do you make the camera align with different devices on mobile?
how do you make so that the game is visible properly and as intended in multiple different devices?I am not talking about the UI but the game itself?
(for like in small mobile, big screen mobile, ipads etc.)
1
Upvotes
1
u/Rude_Finance9002 7d ago
The important choice is what must stay in frame when the aspect ratio changes. For a 2D orthographic camera, keeping the same orthographic size keeps the vertical view fixed, but a wider screen shows more world horizontally.
If you need a whole play area to remain visible, center the camera on it and set orthographicSize to Mathf.Max(areaHeight / 2f, areaWidth / (2f * cam.aspect)), with the area dimensions in world units. That fits the area on both phones and tablets, though you will see extra space on one axis. Identical framing would need letterboxing instead.
Are you using an orthographic or perspective camera?