How do i centralize this gui according to the screen size?

using UnityEngine;
using System.Collections;

public class PlantTower : MonoBehaviour {
	public Material StarterMaterial;
	public Material MOMaterial;
	public bool guienabled = false;
	public GameObject tower;
	public int HowMuchCosts;

	// Update is called once per frame
	void OnMouseDown(){
		guienabled = true;

	void OnMouseOver () {
		renderer.material = MOMaterial;

	void OnMouseExit(){
		renderer.material = StarterMaterial;

	void OnGUI () {
		if (guienabled ==	true){
			GUI.Box(new Rect(575,50,200,400), "Choose Tower");

			if(GUI.Button(new Rect(600,80,150,20), "Normal Tower (GC)")) {
				if (Motor.Instance.GoldenCoins >= HowMuchCosts) {
					Instantiate (tower, transform.position + new Vector3 (0f, 3f, 0f), transform.rotation);
					Motor.Instance.GoldenCoins -= HowMuchCosts;
			if(GUI.Button(new Rect(752,50,23,20), "X")) {
				guienabled = false;

I want to centralize the gui thats inside the ongui void. But i cant find out how to centralize this according the screen size. I just want to centralize the position according the screen size, and not the scale.

You’ll need to calculate appropriate rectangles based on Screen.width and Screen.height.

You could start by calculating the center of the screen (width/2, height/2), or by placing items according to some percentage of the total screen size.

For example, let’s say we have a widget that we’d like to draw in the center of the screen:

//find center of screen
Vector2 center = new Vector2(Screen.width/2f, Screen.height/2f);

//suppose our box is 200x30 pixels
Vector2 rectSize = new Rect(200f, 30f);

//to actually center box, move it left by half-width, up by half-height
Vector2 rectPos = rectSize / 2f;

if (GUI.Button(new Rect(rectPos.x, rectPos.y, rectSize.x, rectSize.y), "Press Button?")) {
	Debug.Log("Button was pressed!");

You get used to the extra math after trying it a few times.