PlayerName Bug

Hello guys!

I'm doing a multiplayer game but I'm having a issue with the playerName when several players are conected in the game.
When I run the game in my computer with a local client, the name above the caracter is right but, when I ask my friends to test it, the other characters are displayed with the name the user chose for themselves.

Here is my code:

public class NicknameController : Photon.MonoBehaviour {

bool alreadyRegistred = false;

public Button createBtn;
public GameObject nicknameInputObj;
public InputField nicknameInput;
public Text nicknameText;

void Awake()
{
CheckRegister();
createBtn.interactable = false;
}

void CheckRegister()
{
if (!alreadyRegistred)
{
nicknameInputObj.SetActive(true);
}
else
nicknameInputObj.SetActive(false);
}

public void NicknameInputChange () {

if(nicknameInput.text.Length >= 2)
{
createBtn.interactable = true;
}
else
{
createBtn.interactable = false;
}
}

public void CreateNickname()
{
PhotonNetwork.playerName = nicknameInput.text;
alreadyRegistred = true;
nicknameText.text = PhotonNetwork.player.NickName;

}
}

It seems to be something simple, but I can't figure it out :confused:

Comments

Sign In or Register to comment.