List of room's player with their properties...


1- After connecting to a game server, I want the room players be notified when a player joins or leaves. I don't know how would that be possible since when OnDisconnectedFromPhoton() is called the player wont send a RPC to the room.

2- Also I need a list of connected players' names, health, team name and scores for every player in the specific room to show in GUI for each player during the game. Also I need a sync clock to show remaining time to each player. Using rooms custom properties is a good solution here while I need update it every seconds? Would you please propose a faster and better idea ?

Thank you.


  • By using a scene photonview on a gameobject and using OnPhotonSerializeView I synced the Level Timer between all players. And also by using a custom list and using below code in OnGUI() I made the GUI work.
    [code2=csharp]if (!photonView.isMine && PlayerName != PhotonNetwork.playerName)
    //do gui stuff for this prefab -> showing health, score, ...

    !photonView.isMine helps me to get access to properties of other player's prefab and show them on screen.
  • 1) When players connect or leave, you don't have to send messages. This is done by Photon internally and you should implement the required event methods, as described in PhotonNetworkingMessage. OnPhotonPlayerConnected() will be called when someone joins a room, e.g.

    2) You could use custom properties. Set them via PhotonNetwork.player and access them via the PhotonView's owner (a Player object, which has the synced custom properties plus name).

    There is a PhotonNetwork.time variable. This is a low-level synchronized server-timestamp. Anything you do with RPCs will be much less precise.