- Home /
This question was
closed Apr 14, 2013 at 07:38 AM by
Fattie for the following reason:
Duplicate Question
Question by
AwesomeFaceHD · Apr 14, 2013 at 07:03 AM ·
guibuttons
Button doesn't show up in pause
The pause function works but there is no button while paused.
var paused : boolean = false;
function Update () {
if(Input.GetKeyDown(KeyCode.Escape) && paused == false)
{
paused = true;
if (GUI.Button(new Rect(10, 10, 200, 50), "Disconnect"))
{
Application.LoadLevel("MainMenu");
Network.Disconnect();
}
Time.timeScale = 0;
}
else if(Input.GetKeyDown(KeyCode.Escape) && paused == true) {
paused = false;
Time.timeScale = 1;
}
}
Comment
Best Answer
Answer by DaveA · Apr 14, 2013 at 07:29 AM
Remove this section of code from Update:
if (GUI.Button(new Rect(10, 10, 200, 50), "Disconnect"))
{
Application.LoadLevel("MainMenu");
Network.Disconnect();
}
and put it in OnGUI():
function OnGUI()
{
if (GUI.Button(new Rect(10, 10, 200, 50), "Disconnect"))
{
Application.LoadLevel("MainMenu");
Network.Disconnect();
}
}
Follow this Question
Related Questions
How do I make a custom font for a GUI button? C# 1 Answer
Tutorials for 2D game GUI 2 Answers
I want to move my cube using GUI buttons? 1 Answer
Only buttons closest to EventSystem (or last in the list under Canvas?) work. 1 Answer
How Can I Create Buttons In World Space and NOT Screen Space 2 Answers