I’ve attached the below code to a GameObject in my game.
The GUI displays correctly, however, when I try to type into a TextField, no text appears. The game behind the GUI is still receiving correct events which I’m reading via Input.GetAxis, so it appears that the TextField/GUI objects arent getting any keyboard events?
Am I missing something simple?
function OnGUI() {
var member_name = PlayerPrefs.GetString("member_name");
if(member_name == "") {
GUILayout.BeginArea(Rect((Screen.width / 2)-300, (Screen.height / 2)-100, 600, 400));
GUILayout.BeginHorizontal();
GUILayout.Label("What is your name?");
member_name = GUILayout.TextField("", GUILayout.Width(300));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Label("What is your email address? (optional)");
var email_address = GUILayout.TextField("", GUILayout.Width(300));
GUILayout.EndHorizontal();
GUILayout.Button("save my high score");
GUILayout.EndArea();
}