Function to Call Seperate GUI script

I’m still relatively new to Unity, so I may have missed something simple, but my question is; What is the Function to, upon clicking a button open a new GUI script?

The goal it to have a GUI button when clicked display a separate GUI menu.

I appreciate any help in advance!

1 Answer

1

Try this

bool showNewMenu;

void Start()
{
    showNewMenu = false;

}


void OnGUI()
{
    if( GUI.Button( buttonRect, "Show new menu" ) )
    {
        showNewMenu = !showNewMenu;
        
    }
   
    if( showNewMenu ) NewMenu();

}


void NewMenu()
{
    // new GUI script

}