I can't see the GameObjects with their relevant usernames when joining a scene / room.

What I'm doing is basically having two options for all players: to create a room and join a room. Each player will have to type in their usernames before create/join room.

If, for example, I am the master client and I see another player join the room, I can definitely see all the correct usernames. But, if I'm not the master client and I join a random room, I can only see my current username through the spawned players, whilst the other gameobjects remain unnamed.

How can I solve this?

I've tried using OnPlayerEnteredRoom but that doesn't seem to solve it.

Here is an example code to see how my game works at the moment:


  • I assume you set the LocalPlayer.NickName before you join the game? Or is it set after joining?

    You may want to clarify if the Player objects have the correct NickName per player. If that's the case, you got the info but it's not shown. However, we can't explain that.

  • Yes, that's correct. The nickname is set before joining the room.

    The main problem is when I'm testing the game from a non-master-client perspective. When I join the room, I'm expecting to see the rest of the players spawned already, but their usernames are not correct at all. It is almost like they didn't set their usernames before joining the room.

  • Then you need to debug this. You could add logs for a first step or use some IDE and debug breakpoints. Figure out if all Players in the list have their NickName available. If so, look at the code, which takes the NickName and updates the UI.

  • I did debug it multiple times, and it seems that the code is not the culprit, in my opinion. I think I am missing something important in terms of how to handle the joining of players, hence why I am discussing about this. 😊

  • Tobias
    Tobias admin
    edited December 2021

    How do you apply the NickName to the UI?

    As in: How does that code look?

  • See the capture png uploaded in my first comment.

  • Instead of go.name = PhotonNetwork.NickName I think it should be PhotonNetwork.NickName = go.name.

  • How? I just want to assign the username of the player to the spawned Game Object as well.

  • Does the log line show up correctly?

  • I can't reproduce the issue.

    Set the NickName before you join a room. Everyone should do that. Then, when entering a room or when someone joins, the player.NickName will be available.

    If you can't make it work, send us a minimal repro project with just the smallest amount of game logic and assets that can repro the issue. Then we can try to help.

    Make sure to use latest PUN 2.

  • I found the solution to this.

    if (View.IsMine) name = PhotonNetwork.NickName;
    else name = View.Owner.NickName;