How to ask player a question, and it is placed into a var.
Ex: what is your name
Asterix
Hello Asterix.
Thanks
[Sorry for double post, I was in the wrong forum.]
How to ask player a question, and it is placed into a var.
Ex: what is your name
Asterix
Hello Asterix.
Thanks
[Sorry for double post, I was in the wrong forum.]
I think there’s a better way to do it :? :?
but I hope this helps…
private var Name = "";
private var show : boolean;
show=true;
function Update()
{
if (Input.GetKeyDown (KeyCode.Return))
{
show=!show;
}
}
function OnGUI ()
{
GUILayout.Label("What's your name?");
if(show)
{
Name = GUI.TextField (Rect (10, 10, 200, 20), Name, 25);
}
if(!show)
{
GUILayout.Label("Hello " + Name);
}
}
Thanks