How to scale something to fit on the screen?

Ok so ive got a conundrum and this is it, my game requires for the map to be scaled down and up based on screen resolution so it fits on the screen… however i cannot get it to work :frowning: i dont know how to achive the wanted effect.

this is my feutile atempt, and i kind of get a resonable number(37 units) wich is i think the right size but it dosent stay in place :frowning: the thing that is getting scaled has a ridgid body and needs one.

If anyone could give me some scripting referances it would be great.

This is what i have so far :slight_smile: if you can see any obvious problems it would be great.

#pragma strict
var Side1 : GameObject;
var Side2 : GameObject;

//var bottom1 = Gameobject;
//var bottom1 = Gameobject;

function Start () 
{
var TOPBOT : Vector3 = camera.ScreenToWorldPoint(Vector3 (1,1.5,Screen.width));
Side1.transform.localScale = TOPBOT;
Side2.transform.localScale = TOPBOT;
}

If your map is just a texture, you can easily fit to screen using GUI.DrawTexture:

 GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height));