Camera placement / size behavior

im totally lost here...

http://img41.imageshack.us/img41/5498/unity1.jpg

as you can see, i got a minimap going on in the upper corner wich works great and all, just had a second camera put up and scaled it as you can see in the inspector,

my problem is that i want people regarding of resolution to have the same SIZE of the minimap window, and only the locations move accordingly,

but when i change screensize this happens

http://img96.imageshack.us/img96/5171/unity2.jpg

it gets all thin (reacts same way in a build and) i want a fixed size, but the placement will have to be the upper right corner always, so 800x600 and 1920x1080 will have same size of minimap (like the way GUI reacts to screen size change)

thanks alot in advance you will really save my butt if you can get me out of this mess!

-Martin

You'll need a script to work out how much of the normalized screen you want it to take up

example:

```

private var lastPos : Vector2 = Vector2.zero;
var absolouteWidth = 100.0; //in pixels
var absolouteHeight = 100.0;
var minimapCam : Camera;

function Update() { if (minimapCam == null) return;

`var currentPos = Vector2(Screen.width, Screen.height);
if ((lastPos -  currentPos).magnitude > 2)
{
    lastPos = currentPos;

    //you can modify this to put it somewhere else if you like
    minimapCam.pixelRect = new Rect(Screen.width - absolouteWidth, Screen.height - absolouteHeight, absolouteWidth, absolouteHeight);
}

```

}

`

Yhe problem is, that the normalized viewport rectangle uses floats to determine its size. These floats are between 0 and 1 and can be read as percentage of the overall screen size. If you want a fixed width of a certain viewport you will have to determine the overall size of the screen (Screen.width, Screen.height) and calculate the factor (between 0 and 1) yourself (factor = fixedWidth / Screen.width) and then tell the viewport to use the calculated size.

{

   public float absolouteWidth = 100; //in pixels
   public float absolouteHeight = 100;

    public GameObject Minicam;
    


     void Update()
    {
        if (Minicam == null) return;

        var lastPos = Vector2.zero;
        var currentPos = new Vector2 (Screen.width, Screen.height);
        if ((lastPos - currentPos).magnitude > 2)
        {
            lastPos = currentPos;


            //you can modify this to put it somewhere else if you like
            gameObject.GetComponent<Camera>().pixelRect = new Rect(Screen.width - absolouteWidth, Screen.height - absolouteHeight, absolouteWidth, absolouteHeight);

        }


    }

the new 2018 way, works a treat