Align to right of screen (already have left and middle. Easy one)

Hey I am trying to get my GUI.Box to print on the right side of the screen and change depending on the resolution, so far I have my left box and middle box set up but can’t find the equation for the right side. Can anyone help? :

var box1Texture : Texture2D;
var position : Rect;


	function Update()		//Set the position to centre screen for crosshair
		{
   			position = Rect((Screen.width), (Screen.height) , box1Texture.width - 200, box1Texture.height) ;
	}

	function OnGUI()
		{
			GUI.DrawTexture(Rect(0.0f, 0.0f, Screen.width, Screen.height), box1Texture);
    GUI.Box (new Rect (Screen.width /2 - 50,Screen.height / 2 - 65,100,50), "MIDDLE BUTTON");
    GUI.Box (new Rect (Screen.width /5 - 50,Screen.height / 2 - 65,100,50), "LEFT BUTTON");
    GUI.Box (new Rect (Screen.width *UNITS GO HERE * ,Screen.height / 2 - 65,100,50), "RIGHT BUTTON");
		}

Additionally, is there a way to scale the gui box depending on screen resolution?

Screen.width is the width of the screen in pixels

0 (zero) would be the far left

20 would be 20 pixels from the left

Screen.width would be the far right

(Screen.width - 50) would be 50 pixels over from the right

in your case, you are creating a box with a width of 100, so you could use

Screen.width - 100

This is a fixed distance from the edge regardless of resolution

Similarly, the way you are using Screen.width/5 is not a good idea, as this will make the box further inward from the left edge, the wider the resolution gets…
you should instead just say 0, or 20, or whatever, if you want it to stay the same distance from the edge at different resolutions

To get a better idea of how your code works with different resolutions, simply set the Game Aspect to “free aspect” and turn on “Maximize on Play”… then hit play, and grab the edges of the unity window and drag them, to change the ratio of the window.

SO, I would say:

 function OnGUI()
       {
    GUI.DrawTexture(Rect(0.0f, 0.0f, Screen.width, Screen.height), box1Texture);
    GUI.Box (new Rect (Screen.width /2 - 50,Screen.height / 2 - 65,100,50), "MIDDLE BUTTON");
    GUI.Box (new Rect (20,Screen.height / 2 - 65,100,50), "LEFT BUTTON");
    GUI.Box (new Rect (Screen.width - 120,Screen.height / 2 - 65,100,50), "RIGHT BUTTON");
       }

To scale the GUI.Box relative to the screen size, you would use Screen.width and Screen.height in the size parameters as well, for example:

GUI.Box (new Rect (20,Screen.height / 2 - 65,Screen.width/ 6,Screen.height/6), “LEFT BUTTON”);

You might want to take a look at that : http://wiki.unity3d.com/index.php/GUIHelpers