- Home /
Pause Menu Issue (Black Screen)
Hi guys, I've been having an ongoing issue with trying to get any pause screen/menu to work in my game. I have tried out various tutorials with different UI methods and scripts but to no avail. The main issue I have with the script I'm using at the moment is that when I hit play the screen is black, but I can hear all of the audio and AI working, I just can't seen anything. When I disable the script, it works as normal. I've tried disabling the Canvas object and switching from GUI text to UI text as well as trying to use textures instead. but still no solution. I know it's probably something really obvious, but i'm rather confused. Here is the script I am using either way...
#pragma strict
private var pauseGame : boolean = false;
private var showGUI : boolean = false;
function Update()
{
if(Input.GetKeyDown("p"))
{
pauseGame = !pauseGame;
if(pauseGame == true)
{
Time.timeScale = 0;
pauseGame = false;
showGUI = true;
}
}
if(pauseGame == false)
{
Time.timeScale = 0;
pauseGame = true;
showGUI = false;
}
if(showGUI == true)
{
gameObject.Find("Pause").GetComponent(Canvas).enabled = true;
}
else
{
gameObject.Find("Pause").GetComponent(Canvas).enabled = false;
}
}
Your answer
Follow this Question
Related Questions
UI Text showing weird string value? 1 Answer
Text wont change to correct value 1 Answer
RPG Text 2D on Object Interaction Javascript 0 Answers
TextField text component not updating 2 Answers