- Home /
player name input field
hey guys how can i change this
PhotonNetwork.player.name = GUILayout.TextField(PhotonNetwork.player.name);
to this
PhotonNetwork.player.name = UiTextField.text = (PhotonNetwork.player.name);
it does not work this way i vant change the text input? thanks
What is UiTextField class? a custom class? Or the TextField class of unity?
What's your end goal here? What sort of behaviour are you looking to make? :)
it is i think a public class. i got this code by following a tutorial and the PhotonNetwork.player.name = GUILayout.TextField(PhotonNetwork.player.name);
was used for player name. but it was standard Gui button i beleve unity build in..
like this..
GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height)); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); GUILayout.Label("Username:"); PhotonNetwork.player.name = GUILayout.TextField(PhotonNetwork.player.name);
but i wanted to change the GUI buttons to UI Buttons and the new button did go well but when in tried changing the GUILayout.TextField. from this ... PhotonNetwork.player.name = GUILayout.TextField(PhotonNetwork.player.name); in to this PhotonNetwork.player.name = UiTextField.text = (PhotonNetwork.player.name); with an GameObject/UI/Input Field .it did work no errors but the problem is i cant change the text annymore its in this part i think..UiTextField.text = (PhotonNetwork.player.name); becouse the other one is like this... GUILayout.TextField(PhotonNetwork.player.name); without the = but removing it didn`t work and i dont know how to do it
thanks by the way for helping......Wesley
If you have a reference to your input field, you can access its text property like so. I'm assu$$anonymous$$g you're using UnityEngine.UI:
public InputField inputField;
void Start()
{
inputField.text = PhotonNetwork.player.name;
}
I believe that you're having issues because you're setting the text component of the input field in the Update.
Your answer
Follow this Question
Related Questions
Unity Photon Name-Tag Problem 2 Answers
Multiple Buttons To Use One Text Input Field 1 Answer
DontDestroyOnLoad and Photon, players not visible 1 Answer
How to get random names that will be the same later on 0 Answers
how to put the name of a car ??? 0 Answers