OnGui (c#) Question, want to make a button that opens a box

Trying to make a button in OnGui (c#) and I want the button to open a new rect(angle) and I have no idea how. I literally started learning last night so it’s probably something really simple I’m missing.

This is the code I have so far:

using UnityEngine;
using System.Collections;

public class Menu : MonoBehaviour {

// Use this for initialization
void Start () {
	
}

// Update is called once per frame
void Update () {
	
}


void OnGUI () {

	GUI.Box (new Rect (640, 360, 640, 360), "Menu");

	if (GUI.Button (new Rect (920, 390, 80, 20), "Inventory")) {
		//Debug.Log("Does nothing yet");
		GUI.Box (new Rect(10, 10, 200, 200), "inventory");
	}

					
					
}

}

Thank you for your help :slight_smile:

Hope You Are Looking For This…

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

	public bool flag;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	void OnGUI () {
		if(!flag)
		{
			GUI.Box (new Rect (Screen.width/2-100, Screen.height/2-100, 150, 150), "Menu");
		
			if (GUI.Button (new Rect (Screen.width/2-60, Screen.height/2-50, 80, 20), "Inventory")) 
				flag=true;
		}
		if(flag)
			GUI.Box (new Rect (Screen.width/2-100, Screen.height/2-100, 200, 200), "Inventory");
		
		
		
	}
}