- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
KG3 · May 24, 2013 at 01:29 AM ·
guibuttonpausegui.button
GUI Button Not Displaying?
Hey guys the GUI Buttons are not Displaying in the currently creating a Test Game, I am a current Newbie at using Unity and a C#, C++ Programmer whois just learning the Documentation. Here is the Code in C#
using UnityEngine;
using System.Collections;
public class Pause_Menu : MonoBehaviour
{
bool paused = false;
void Update()
{
if (Input.GetButtonDown("Pause"))
{
if (!paused)
{
Time.timeScale = 0;
paused = true;
}
else
{
Time.timeScale = 1;
paused = false;
OnGui();
}
}
}
void OnGui()
{
if (paused)
{
if (GUI.Button(new Rect(10, 50, 100, 30), "Resume"))
{
Time.timeScale = 1.0f;
paused = false;
}
if (GUI.Button(new Rect(10, 90, 100, 30), "options"))
{
}
if (GUI.Button(new Rect(10, 130, 100, 30), "Quit"))
{
}
}
}
}
The Game Pauses Correctly the Buttons are not showing up when I it Pauses though
Comment
Best Answer
Answer by robertbu · May 24, 2013 at 01:30 AM
The function name is OnGUI() so OnGui() will not work.
This issue comes up frequently. One just like it came across the list yesterday.
Your answer
Follow this Question
Related Questions
(Unity 4.6) Button animations 1 Answer
GUI Button appears when Paused 1 Answer
multiple GUI.Buttons at the same time 1 Answer
Make more buttons appear, on button click. 1 Answer
Toggling multiple button states 2 Answers