How do I close the GUI after the user enters a value? Is there any way to stop execution of the entire app (from inside this script) until a value is entered?
using UnityEngine;
using System.Collections;
using UnityEngine;
using UnityEditor;
public class Popup : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
string record="";
void OnGUI() {
//Participant Number/Record:
GUILayout.Label ("enter participant id:");
record = GUILayout.TextField(record);
//GUILayout.TextField()
if (GUILayout.Button("Submit")) {
OnClickSavePrefab();
GUIUtility.ExitGUI();
}
}
void OnClickSavePrefab() {
record = record.Trim();
if (string.IsNullOrEmpty(record)) {
EditorUtility.DisplayDialog("Unable to save record", "Please specify a valid participant record.", "Close");
return;
}
// Save your prefab
Debug.Log ("record:" + record);
}
}