- Home /
Building a aspect/resolution-independent 2D scene with an orthographic Camera
Hi guys!
I'm new to Unity and currently building a simple 2D game for mobile that should look decent on as many aspect ratios as possible.
The game is fixed to portrait mode, so I expect aspect ratios between 9:16 and 3:4. What I would like to do is make the game look good in 9:16 and then optionally show more of the (static) background on the left and right if the aspect allows for it. So vertically, the same amount is shown for all aspect ratios.
To get this effect, I've attached my (placeholder) background image as a GameObject to an orthographic camera and scaled the background to fit the height of the camera's FOV (see attached image). This would be 9:16, and more of the grey area is shown as the aspect gets wider.
I've tried this with a couple devices and it seems to work fine.
My questions are:
Are there any problems with this approach? If so, what would be the preferred way to get this effect?
What's the actual resolution I'm working at?
If I move/place all objects based on "% of screen width/height", do I even have to care about resolution?
Thanks!
Your answer
Follow this Question
Related Questions
2D Aspect Ratio Of Camera 2 Answers
The infuriating Orthographic camera Vs Android Resolution. 2 Answers
Developing on multiple resolutions 1 Answer
Aspect Ratios aren't displaying properly on build 1 Answer
Target android/ios with same assets? 2 Answers