Support => TNet 3 Support => Topic started by: Gravitox on June 20, 2015, 04:18:17 PM
Title: Change name of transforms/gameobjects in hierarchy
Post by: Gravitox on June 20, 2015, 04:18:17 PM
Hi
I try to extend the "from scratch" example so that the GameObjects that represents the players in the hierarchy show the/change to the playerName which I added to the Gameplayer script. For testing the playerName is hardcoded.
All I have achieved is that either all GameObjects gets the same name or at least one GameObjects name is "Player (Clone)".
...but this changes all names of the GameObjects to the same.
I also tried to change the name on creation by...
tno.Send(3, Target.AllSaved, playerName);
[RFC(3)]
void OnSetPlayerName(string name){
transform.name= name;
}
...with the same result as above.
In every build I changed the hardcoded playerName in the GamePlayer script.
What am I doing wrong? How do I change the GameObject names right?^
Thanks for reading!
Title: Re: Change name of transforms/gameobjects in hierarchy
Post by: ArenMook on June 21, 2015, 09:36:02 PM
OnNetworkPlayerRenamed gets called on all clients. You need to check -- is this my player? If so, then rename. You aren't checking anything. Same with RFC.