Handle with camera

Hello community,

I am very greatfull for Unity3D. I am really close to finish my first game! :slight_smile:

However, I am with a problem: Camera and different resolutions (Android!!!).

My game is done at 16:9 aspect ratio, and everything looks really nice (at least at my eyes)!

However, if I change the aspect ratio or resolution, well, my game is complete destroyed.

Here’s how it looks like at 16:9:

Here’s how it looks in 480x320:

How can I handle the camera, so the scene looks exactly the same in all resolutions?

I am really happy that my team work now with Unity.


You need to read Screen.width and Screen.height, and use whatever values you get from those to position and scale the corner squares.

You can divide one of those by the other to get your aspect ratio.

Note that if your game is targeting the webplayer, you can’t use the values of Screen.height and Screen.width in Awake or Start, because they will be wrong for some stupid reason, you just need to re-check a second after it finished loading.