I did this exact same thing on the main menu screen but with an options button opening a new options gui.
I just want to create a new gui box and buttons after this button is clicked. I am getting now console errors, but no box is appearing. (I have assigned the appropriate textures.)
#pragma strict
//var startButton : Texture;
var numLives : GUIText;
var numIneternets : GUIText;
var pauseMenu = false;
var menuBox : Texture;
var quit : Texture;
var pauseButtonReturn : Texture;
var pauseButton : Texture;
var playButton : Texture;
var isPaused : boolean = true;
numLives.text = "Lives: " + ply.currentPlayerLives.ToString();
numIneternets.text = "Internets: " + ply.internets.ToString();
function menuAppear() {
GUI.Box (Rect (Screen.width / 2 + 15, Screen.height / 2 - 100, 200, 200), menuBox, "");
if (GUI.Button(Rect(Screen.width / 2 + 22, Screen.height / 2 - 91, 120, 120), quit, "")) {
Application.Quit();
}
}
function OnGUI() {
if (GUI.Button (Rect (Screen.width / 350, (Screen.height / 2) + 240, 50, 50), pauseButton, "")) {
if (isPaused != true) {
pauseMenu = false;
Time.timeScale = 0.0;
isPaused = true;
audio.Pause();
pauseButton = playButton;
} else {
pauseMenu = true;
Time.timeScale = 1.0;
isPaused = false;
audio.Play();
pauseButton = pauseButtonReturn;
}
if (pauseMenu){
menuAppear();
}
}
}