- Home /
Question by
Guzaii · Oct 16, 2013 at 03:18 PM ·
javascriptgui
Pause Menu background problem
I've got a little problem with my Pause menu, and i dont know how to solve it.. The background keeps being the "Top layer", so that you are unable to read the text (The background is a picture). And I'm clueless about how i can fix it.
#pragma strict
private var pauseEnabled = false;
var guiOn : boolean;
var frameStyle : GUIStyle;
var buttonSizeRestart : Rect = Rect(0,0,0,0);
var buttonSizeQuit : Rect = Rect(0,0,0,0);
var buttonSizeMainMenu : Rect = Rect(0,0,0,0);
var buttonSizeBackground : Rect = Rect(0,0,0,0);
var buttonTextRestart : String;
var buttonTextQuit : String;
var buttonTextMainMenu : String;
var backgroundStyle : GUIStyle;
function Start () {
pauseEnabled = false;
Screen.showCursor = true;
}
function Update () {
if(Input.GetKeyDown("escape")){
if(pauseEnabled == true){
pauseEnabled = false;
Time.timeScale = 1;
}
else if(pauseEnabled == false){
pauseEnabled = true;
Time.timeScale = 0;
}
}
if (Input.GetKeyDown(KeyCode.Escape )){
if(guiOn){
guiOn=false;
}
else{
guiOn=true;
}
}
}
function OnGUI(){
if(pauseEnabled == true){
if(GUI.Button(buttonSizeRestart,buttonTextRestart,frameStyle)){
Application.LoadLevel("Restart");
}
if(GUI.Button(buttonSizeQuit,buttonTextQuit,frameStyle)){
Application.Quit();
}
if(GUI.Button(buttonSizeMainMenu,buttonTextMainMenu,frameStyle)){
Application.LoadLevel("Main Menu");
}
}
if (guiOn){
if(GUI.Button (buttonSizeBackground,"",backgroundStyle));
}
}
Here is the background: (Its just a Transparent dark background, so that you focus the text)
[1]: /storage/temp/16603-pause+background.png
pause background.png
(5.6 kB)
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Setting Scroll View Width GUILayout 1 Answer
Pause Menu 5 Answers
GUI problem 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers