Hey! i got a script so when he connects to the server it calls "OnNetworkConnect", and that works just fine. But then i want to change the player name in that function, and apparently that wont work
void OnNetworkConnect(bool succes, string message){
if(succes){
Debug.Log("Playername before: " + TNManager.playerName);
TNManager.playerName = "ChangedName";
Debug.Log("Playername after: " + TNManager.playerName);
loadMenu();
}
else{
Debug.Log("there was an error: " + message);
onFailedConnection();
}
}
The name is both Guest before and after the change.
Ive also tested making the name change upon start in the menu that loads
void Start(){
Debug.Log(TNManager.playerName);
TNManager.playerName = "ChangedName";
Debug.Log(TNManager.playerName);
}
And both here returns Guest.
Then i tested making an Coroutine with a delay by 0.1 seconds, then change the name(in the start function of the menu), Then it works just fine! Is it really neccisary to have a delay for changing name of the player?