Hi, I’m working in the main menu of my game and I’m trying to make the exit button, in which the game first asks if the player wants to exit and then allow him. I got the GUI Buttons working right but I would like that they only appear when the player clicks on the exit button, how can I do that with the current code?
What appears with the slashes is what I tried but it doesn’t works.
Verification Code:
public class Verification : MonoBehaviour {
void OnGUI ()
{
//if(Input.GetMouseButtonDown(0))
{
if (GUI.Button (new Rect (Screen.width/2 - 100,Screen.height/2,100,60), "Yes"))
{
print ("You clicked Yes!");
}
if (GUI.Button (new Rect (Screen.width/2 + 20,Screen.height/2,100,60), "No"))
{
print ("You clicked No!");
}
}
}
}