Scaling my game

Okay, so:

I am making an android game. I want everything to scale to the size of the screen I’m using. Further, my static background needs to scale (as well as every other object), but if the aspect ratio is less than the AR of the background image I want the image to be cut off at the edges. So basically I want everything to get bigger or smaller according to the size of the screen. Will this happen automatically, or on larger screens will my game just be surrounded with blank space?

Further, I have a game object I need to always be at the corner of the screen. I’m guessing I should use a script to determine the width of the screen and place it a few coordinates up and right of that on start?

The game is only in landscape mode if that matters. How do I go about this? I previously had the background as a plane with an image on it but it didn’t take up the whole screen and I think it might not be the right thing to do? Maybe use a quad?

How do I test to make sure that this works? I only have my one android phone to test it on.

Perspective or orthographic camera?

The settings of the camera define how much of the world is drawn on screen. With an orthographic camera for example, no matter the device screen size, the “orthographic size” defines the half-height of the view in world units. Set it to 0.5 and a 1 unit high sprite right in front of the camera will touch the bottom and top of the screen on all devices.

You can get the screen dimensions in world units like this

float height = Camera.main.orthographicSize * 2;
float width = height * Screen.width/ Screen.height; // basically height * screen aspect ratio

With a perspective cam it’s a bit trickier though the principles are the same.