- Home /
2D Game Aspect Ratio Stretching And Resolution Help
I have done research about aspect ratios and resolutions however I cannot seem to understand what I need to do to make the elements in my game stretch or shrink depending on the screen size. It is kind of hard to explain so here is an image of my problem! I am developing for the mobile market and I would like my game to be universal for all platforms and aspect ratios however I do not know how to do this. Please help!!
This is what it should look like.
This is what it looks like on my phone.
That looks like the type of effect you would desire, if it were to shrink to fit the screen size it would distor everything and would make if hard to see properly. If you want to be able to view everything on the screen try increasing the 'Size' property of the Orthographic Camera until eveything you want is visible.
I've never seen a square smartphone. Are you saying you want it to be vertically letterboxed? That would suck. $$anonymous$$aybe you should limit it to landscape mode.
Ok so I took your advice and limited the game to only display in landscape mode but I have another question. $$anonymous$$y phone is at a resolution of 800x480 if somebody has a different sized screen that is larger or smaller than that, will the game automatically try to fill the screen or will it letterbox? How do games that are on Google play and the iPhone market always fit to my screen because I've never seen a game or application letterbox to fit my on my phone or maintain an aspect ratio.
It will automatically fill the screen. What you can do is calculate the ratio of Screen.width to Screen.height and use that to adjust the camera FOV.
For a free-scrolling, isometric tiled game like yours, it shouldn't really matter if you can see more to the sides or more to the top.
According to the unity script reference field of view is ignored when the camera is orthographic. How exactly am I supposed to calculate this? How would the script look?