Hi.
I wrote a function called “MainMenuWindow” and in my OnGUI Function it creates a rect with the function inside.
I can’t figure out how to make 2 buttons next to each other in my code. does anyone have any ideas?
void MainMenuWindow(int windowID)
{
GUILayout.Label(gameName);
//GUILayout.Label("A game about something");
GUILayout.Space(40);
//The player disconnects from the server when they press the
//disconnect button.
if(GUILayout.Button("Continue", GUILayout.Height(buttonHeight)))
{
Debug.Log("Continue");
audio.PlayOneShot(clickSound);
}
GUILayout.Space(10);
if(GUILayout.Button("Level Select", GUILayout.Height(buttonHeight)))
{
Debug.Log("Level Select");
audio.PlayOneShot(clickSound);
}
GUILayout.Space(10);
if(GUILayout.Button("Help", GUILayout.Height(buttonHeight)))
{
Debug.Log("Help");
audio.PlayOneShot(clickSound);
}
GUILayout.Space(10);
if(GUILayout.Button("Options", GUILayout.Height(buttonHeight)))
{
Debug.Log("Options");
audio.PlayOneShot(clickSound);
showMainMenuWindow = false;
showOptionsWindow = true;
}
GUILayout.Space(10);
if(GUILayout.Button("Quit", GUILayout.Height(buttonHeight)))
{
audio.PlayOneShot(clickSound);
Application.Quit();
}
}
void OnGUI ()
{
if(showMainMenuWindow == true)
{
GUI.skin = _GUISkin;
mainMenuWindowRect = new Rect(Screen.width / 2 - mainMenuWindowWidth / 2, Screen.height / 2 - mainMenuWindowHeight / 2,
mainMenuWindowWidth, mainMenuWindowHeight);
mainMenuWindowRect = GUILayout.Window(1, mainMenuWindowRect, MainMenuWindow, "");
}
}