- Home /
Question by
Hexuba · Feb 25, 2013 at 07:51 PM ·
visiblegui button
When I click on a button, I want another one to appear next to it with a message confirming the action.
Sorry, I'm just new to scripting and I don't know how this works... I created a button and the code is written below:
if (GUI.Button(Rect(520,340,150,40), "Quit Game") == true)
{...}
Comment
Answer by Ben Blaut · Feb 25, 2013 at 09:44 PM
Something like this:
private var showPopup = false;
private var popupButton = false;
function OnGUI() {
if (GUI.Button(Rect(520,340,150,40), "Quit Game") {
showPopup = true;
}
if (showPopup) {
popupButton = GUI.Button(Rect(670,340,200,40), "Are you sure you want to quit?");
}
if (popupButton) {
//Do quit operation(s)
showPopup = false;
}
}
Your answer

Follow this Question
Related Questions
shield if hit get visible? 0 Answers
Play sound when enemy is visible on the screen? 1 Answer
Keep my custom handle visible even if object is not selected? 2 Answers
OnBecameVisible does not work 2 Answers
mouse cursor not visible on VR 1 Answer