Unity 2D : How to support multi platform and different aspect ratio devices in Unity 2D?

Virag Brahme picture Virag Brahme · Sep 29, 2014 · Viewed 8.3k times · Source

I am newbie to Unity 2D and creating a game in it. I wanted to run that game on almost all devices (Android, iOS, Mac, Windows and web. I am bit curious to see how Unity2D will handle this scenario and give the same user experience on various devices.

Also I noticed that I can preview my game in different aspect ratios. Is it the aspect ratio of the screen (like how the game would look on this type of screen) or of the camera (would look the same on all screens)? Do I need to provide different image resources based on the device's resolution?

Should I do something special to allow support for different resolutions, aspect ratios, etc?

Any help will be appreciated.

Answer

sdabet picture sdabet · Feb 26, 2015

Aspect ratio management is explained in the following blog post: http://2sa-studio.blogspot.com/2015/01/handling-aspect-ratio-in-unity2d.html

Basically the orthographic camera has a size parameter which defines the half-height of the world area which will be rendered on screen.

Unity strategy is: fit rendered area height to screen height. Then the visible width varies depending on the screen ratio.