Open and Close a GUI.Box at the same time

What I am trying to do is create an in-game menu GUI, and am having trouble closing some boxes. I have seen answers for similar problems, but not to this extent. After clicking a button and opening a box the player realizes this was the wrong choice and needs to click another button, kind of an “oops” thing.

So, if possible, is there a way to script closing an open GUI.Box and at the same time opening another?

My knowledge is very limited and I am learning as I trudge along, thank you for any assistance.

Script so far:

using UnityEngine;
using System.Collections;

public class NewGUIScript: MonoBehaviour
{
public GUISkin testSkin;

bool openMenu = false;
bool openPlayer = false;
bool openNew = false;
bool openSave = false;
bool openLoad = false;
bool openSettings = false;
bool openQuit = false;
bool openAbout = false;
bool boxDrawn = false;

private int width = 0;

void OnGUI()
{
	GUI.skin = testSkin;
	
	GUI.Box( new Rect( 1, 1, 70, 30), "");
	if (GUI.Button( new Rect( 6, 6, 60, 20), "Menu"))
		openMenu = !openMenu;
	
	if (openMenu)
	{
		GUI.Box( new Rect (1, 29, width, 163), "");
		if (boxDrawn)
		{
			if (GUI.Button( new Rect( 6, 35, 125, 20), "Player Setup"))
				openPlayer = true;
			if (GUI.Button( new Rect( 6, 57, 125, 20),"New Game"))
				openNew = true;
			if (GUI.Button( new Rect( 6, 79, 125, 20), "Save Game"))
				openSave = true;
			if (GUI.Button( new Rect( 6, 101, 125, 20), "Load Game"))
				openLoad = true;
			if (GUI.Button( new Rect( 6, 123, 125, 20), "Settings"))
				openSettings = true;
			if (GUI.Button( new Rect( 6, 145, 125, 20), "Quit Game"))
				openQuit = true;
			if (GUI.Button( new Rect( 6, 167, 125, 20), "About"))
				openAbout = true;
		}
	}
	
	if (openPlayer)
		GUI.Box( new Rect( 133, 33, 160, 50), "Player Setup Box");
	
	if (openNew)
		GUI.Box( new Rect( 133, 55, 160, 50), "New Game Box");
	
	if (openSave)
		GUI.Box( new Rect( 133, 77, 160, 50), "Save Game Box");
	
	if (openLoad)
		GUI.Box( new Rect( 133, 99, 160, 50), "Load Game Box");
	
	if (openSettings)
		GUI.Box( new Rect( 133, 121, 160, 50), "Game Settings Box");
	
	if (openQuit)
		GUI.Box( new Rect( 133, 143, 160, 50), "Quit Game Box");
	
	if (openAbout)
		GUI.Box( new Rect( 133, 165, 160, 50), "About Game Box");
}

void Update () 
{
	if (openMenu == true && width < 135 )
	{
		width += 9;
		if(width == 135)
			boxDrawn = true;
	}
	
	if (!openMenu)
	{
		width = 0;
		boxDrawn = false;
	}
}

}

I guess there should always be only one box visible, right?

public enum EMenuState
{
    None,
    Player,
    NewGame,
    Save,
    Load,
    Settings,
    Quit,
    About
}

public EMenuState menuState = EMenuState.None;

void OnGUI()
{
    GUI.skin = testSkin;

    GUI.Box( new Rect( 1, 1, 70, 30), "");
    if (GUI.Button( new Rect( 6, 6, 60, 20), "Menu"))
        openMenu = !openMenu;

    if (openMenu)
    {
        GUI.Box( new Rect (1, 29, width, 163), "");
        if (boxDrawn)
        {
            if (GUI.Button( new Rect( 6, 35, 125, 20), "Player Setup"))
                menuState = EMenuState.Player;
            if (GUI.Button( new Rect( 6, 57, 125, 20),"New Game"))
                menuState = EMenuState.NewGame;
            if (GUI.Button( new Rect( 6, 79, 125, 20), "Save Game"))
                menuState = EMenuState.Save;
            if (GUI.Button( new Rect( 6, 101, 125, 20), "Load Game"))
                menuState = EMenuState.Load;
            if (GUI.Button( new Rect( 6, 123, 125, 20), "Settings"))
                menuState = EMenuState.Settings;
            if (GUI.Button( new Rect( 6, 145, 125, 20), "Quit Game"))
                menuState = EMenuState.Quit;
            if (GUI.Button( new Rect( 6, 167, 125, 20), "About"))
                menuState = EMenuState.About;
        }
    }

    switch(menuState)
    {
        case EMenuState.Player:
            GUI.Box( new Rect( 133, 33, 160, 50), "Player Setup Box");
            break;
    
        case EMenuState.NewGame:
            GUI.Box( new Rect( 133, 55, 160, 50), "New Game Box");
            break;
    
        case EMenuState.Save:
            GUI.Box( new Rect( 133, 77, 160, 50), "Save Game Box");
            break;
    
        case EMenuState.Load:
            GUI.Box( new Rect( 133, 99, 160, 50), "Load Game Box");
            break;
    
        case EMenuState.Settings:
            GUI.Box( new Rect( 133, 121, 160, 50), "Game Settings Box");
            break;
    
        case EMenuState.Quit:
            GUI.Box( new Rect( 133, 143, 160, 50), "Quit Game Box");
            break;
    
        case EMenuState.About:
            GUI.Box( new Rect( 133, 165, 160, 50), "About Game Box");
            break;
    }

}

I was reading this and needed a menu like it, however I noticed the little menu boxes would stay open all the time. so I edited the code to add the following.
if (openMenu)

			{
				GUI.Box( new Rect (1, 120, width, 340), "Options");
				if (boxDrawn)
				{
					if (GUI.Button( new Rect( 6, 150, 125, 20), "Quit Game"))
						menuState = EMenuState.Quit;
					if (GUI.Button( new Rect( 6, 200, 125, 20),"New Game"))
						menuState = EMenuState.NewGame;
					if (GUI.Button( new Rect( 6, 250, 125, 20), "Save Game"))
						menuState = EMenuState.Save;
					if (GUI.Button( new Rect( 6, 300, 125, 20), "Load Game"))
						menuState = EMenuState.Load;
					if (GUI.Button( new Rect( 6, 350, 125, 20), "Settings"))
						menuState = EMenuState.Settings;
					if (GUI.Button( new Rect( 6, 400, 125, 20), "Player"))
					    menuState = EMenuState.Player;
					if (GUI.Button( new Rect( 6, 450, 125, 20), "About"))
						menuState = EMenuState.About;
				} 

			
			}
//this by default makes the menus little boxes not display  
			if(!openMenu){
				menuState = EMenuState.None;
			}

By adding “!openMenu” you can add this to a pause script if you wanted, also makes it a little cleaner.