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?