- Home /
Once more with the Aspect Ratio's
Hi all,
I've been googling the hell out of this for a few days now and have found mixed explanations on how to get it to work. Problem is, they all confuse the hell out of me. Some more so than others. So in a nutshell...
How does everyone deal with different screen resolutions for a 2D Game?
For example, I have a character that is 706x576 (Just a 2d character I found on the internet, I didn't make it)
What I want to know is, I've set the scale of the character to 0.3, 0.3, 0.3 as this is what looks best in the editor. How do I then scale that image for different mobile devices? Currently I'm only using my Samsung Galaxy S4 as a testing device for this game. The resolution of this mobile device is 1080 x 1920 if it helps people explain the answer to me xD
Thanks ~
Answer by AmazingDeveloper2 · Mar 10, 2015 at 07:38 PM
You can put all your object inside one parent object and change it's scale values.
public GameObject scene; // parent GO
Resolution[] resolutions;
void Start() {
resolutions = Screen.resolutions;
foreach (Resolution res in resolutions)
print(res.width + "x" + res.height);
Screen.SetResolution(resolutions[0].width, resolutions[0].height, true);
Screen.SetResolution (1366, 768, true);
}
Value of the scale for each resolution you can calculate using proportion. For 1366*768 and lower:
1366*768 - 1 // scale for x,y,z
1360*768 - 0.99560761
1280*768 - 0.94117647
1024*768 - 0.74963397
800*600 - 0.58565154