How to set a "Player X Joined the room?"

I'm tring to setup a simple script that notify the Players in a room when somebody enter.

Problem is that actually the nick doesnt get read, can somebody help? It's my first PUN project.

This is the script:

public override void OnPlayerEnteredRoom(Player newPlayer)
{
base.OnPlayerEnteredRoom(newPlayer);

Debug.Log($"{newPlayer.NickName} JOINED THE ROOM");
}

Answers

  • strange. that should be working... try removing base.OnPlayerEnteredRoom(newPlayer);
  • You are right , OnPlayerEnteredRoom will be triggered as soon as someone joins the room. by that time you may not receive the newly joined player's details stored in Player properties. so you can rely on OnPlayerPropertiesUpdate method to get these details.