Question by
nubby_bubbs · Nov 26, 2015 at 06:00 PM ·
c#popupclose
How do you make a script to close out this pop up menu?
Title explains it all, I suck at coding some things. I've been trying to do stuff for a while, and still can't get it.
Here is code:
using UnityEngine;
using System.Collections;
public class Popup : MonoBehaviour {
public Rect windowRect = new Rect(200, 200, 1200, 500);
void OnGUI() {
windowRect = GUI.Window(0, windowRect, DoMyWindow, "Controls: WASD/Arrow Keys: Move | R: Reset| Esc: Quit Game" +
" || New Features: This Popup Of Course.| Day And Night System.|| Running Version 3");
}
void DoMyWindow(int windowID) {
if (GUI.Button (new Rect (10, 20, 100, 20), "Ok, Whatever"))
show windowRect = false;
}
}
Comment
Answer by ttesla · Nov 27, 2015 at 08:07 AM
You may just disable the Popup script.
void DoMyWindow(int windowID)
{
if (GUI.Button(new Rect(10, 20, 100, 20), "Ok, Whatever"))
this.enabled = false;
}