Android Resolutions Independent

Hi! I started with unity some weeks ago. Im trying to make a simple side-shooter 2d game, i had set the camera with a script to 1280x720 so i can test it with my phone on landscape orientation.

There are a lot of resolutions for android, how should i work around this for not getting sprites scaled or off screen?

Thanks :slight_smile:

Try to use orthographic projection for main camera and set ur gameplay field mostly on center, not to borders of screen.
Also you can use some sort of scale system by scripting it, but it can cause some issues with visualisation of your project. So just turn out your gameplay field out of screen borders.
For GUI u can use

/* Screen.width & Screen.height example */


// JavaScript
function OnGUI () {
    GUI.Box (Rect (0,0,100,50), "Top-left");
    GUI.Box (Rect (Screen.width - 100,0,100,50), "Top-right");
    GUI.Box (Rect (0,Screen.height - 50,100,50), "Bottom-left");
    GUI.Box (Rect (Screen.width - 100,Screen.height - 50,100,50), "Bottom-right");
}

See also GameObject width in screen space - Unity Answers