- Home /
unity3d GUI textfield problem
I created a text field but I can't write in it? :( I can select the typing area but I can't write anything!? Why can't I?
Here's the lines:
public string Username;
void OnGUI(){
PhotonNetwork.player.name = GUI.TextField(new Rect(50,0,100,30), Username);
}
Comment
Best Answer
Answer by robertbu · Jul 26, 2014 at 08:04 PM
You are not using TextField properly. Do:
void OnGUI(){
Username = GUI.TextField(new Rect(50,0,100,30), Username);
PhotonNetwork.player.name = Username;
}
You don't have an submit logic here, but this will get you up and running with typing text.