- Home /
Question by
gioelegentile · Oct 25, 2014 at 05:15 PM ·
androidwindowtextfieldpopup
Popup opened by event. Android
I just want to made a registration form with username and password TextFields, and when the registration is successful i would bring up a popup window titled "Registration successful", and with a button to change scene (going a login scene). This is my code:
var result:boolean; //this variable attests that registration has been successful
var username = "";
var password = "";
function OnGUI ()
{
username = GUI.TextField (new Rect (x, y, width, height), username);
password = GUI.PasswordField (new Rect (x, y, width, height), password);
if (GUI.Button (new Rect (x, y, width, height), "Sign In")) {
signIn ();
if (result) {
/* I just want my PopupWindow here */
}
}
}
var URL0 = "http://example.php";
function signIn() {
var form = new WWWForm();
form.AddField("username", username);
form.AddField("password", password);
var w = WWW(URL0, form);
yield w;
if (w.error) {
print(w.error);
} else {
result = w.text == "true" ? true : false;
w.Dispose();
}
}
I tried to put a PopupWindow in there, but it does not appear!
Comment
PopupWindow is an Editor class and is used to extend the Unity Editor, not for runtime on mobile or desktop. Sorry.
You can however use the other GUI class to create your own UI and display it (with title) on screen.
Your answer
Follow this Question
Related Questions
android textfield problem 1 Answer
Unity Scale One Text Field GUI 2 Answers
A node in a childnode? 1 Answer
Android native popup window 4 Answers