Receiving info upon joining server?

Is there a way I can receive certain information about the server upon joining the main scene? I am using the master option to have everyone stay on the same scene, but I cannot figure out how to have the master client send info about the room to a player once they connect. I can write a method in some script that would get the information, but is there a master object that I can attach that method to? Thanks.

Comments

  • You can use room properties. Those are not dependent on any GameObject and sent to clients which join the room.
    Changing the scene via PhotonNetwork.LoadLevel() is done like that. If you just want to sync the scene, simply use it and set PhotonNetwork.automaticallySyncScene to true.
  • Ive implemented a method or two attached to the game object of the master clients matchmaking script. These methods send and update information via RPCs to the player given to me by OnPhotonPlayerConnected. Is this a reasonable solution? Thanks again Tobias.
  • It's ok but using the properties is leaner and probably more stable.
    Consider the situation when a player joins and the master leaves just after getting the join event. The new master won't be assigned before the join and suddenly you have a player who didn't get required data.
    Worst of all: This will look like Photon is dropping messages and you will go nuts ;)
  • How are room properties set and received? I noticed there was a hash table called custom room properties but it was not of type object hashtable. How would I go about using it? Thanks.
  • Room.customProperties are a read-only "cache" of custom properties of a room. Set via Room.SetCustomProperties.
    All keys are string-typed and the values depend on the game/application.
  • That is a lot more efficient. Thanks again Tobias.
  • Glad it helped!
    Let us know when you're going to show your game :)