Screen adaptation on Smartphones and Tablets

Hello guys, I want to develop a multi-plataform game, to run on smartphones, iPhone, iPad and Tablets, the problem is the resolution of the screen, how can I set a adaptable screen for each smartphone or tablet, have some script that do this ?

This may be a good starting point.

Declare these variables somewhere at the top of your script.

var height : float;
var width : float;

I added the below into function Start()

	height = Screen.height;
	width = Screen.width;

Then you can manipulate things like camera zoom/angles and GUI elements based off these numbers.

e.g for screen less than 512px wide you can arrange your GUI elements differently to screens above 800 but below 1280.
The below code isn’t perfect as it was my first attempt at doing such a thing but it will hopefully help guide you.

What it is doing is moving and resizing GUI elements based on screen size.

	if(width <= 512)
	{
	moveTouchPad.guiTexture.pixelInset = Rect(0,0,64,64);
	moveTouchPad1.guiTexture.pixelInset = Rect(66,0,64,64);
	M4SwitchPad.guiTexture.pixelInset = Rect(130,0,64,32);
	ShotgunSwitchPad.guiTexture.pixelInset = Rect(200,0,64,32);
	PistolSwitchPad.guiTexture.pixelInset = Rect(270,0,64,32);
	jumpTouchPad.guiTexture.pixelInset = Rect(-70,0,64,64);
	}
	else if(width <= 855)
	{
	moveTouchPad.guiTexture.pixelInset = Rect(0,0,96,96);
	moveTouchPad1.guiTexture.pixelInset = Rect(98,0,96,96);
	M4SwitchPad.guiTexture.pixelInset = Rect(198,0,96,64);
	ShotgunSwitchPad.guiTexture.pixelInset = Rect(296,0,96,64);
	PistolSwitchPad.guiTexture.pixelInset = Rect(394,0,96,64);
	jumpTouchPad.guiTexture.pixelInset = Rect(-100,0,96,96);
	}