Send message between different rooms

Options
I want to achieve a function every player in each room should send a message to a special player( in different rooms). How can I do?? For example students from different group (it's like different room in network) should submit there score to a teacher.

Comments

  • vadim
    Options
    You can send messages from room to lobby in form of room custom properties. But no way to send data between rooms or from lobby to room.
    So if teacher sits in lobby he can observe scores from all the rooms if you store scores in room properties.

    Another option is to use Chat API. It works in parallel with PUN and can be used for arbitrary data send or broadcast.
  • Thank you for answering my question. How can I send messages from room to lobby and customize room properties? Is there some existing function I can use? By the way, I come from China and my English is really poor.There maybe many syntax error in my words. Forgive me !
    Thanks again
  • vadim
    Options
    You can use single "scores" custom property:
    "scores" : {
    "player1" : 10
    "player2" :3
    ...
    }

    While client is in room, it can set custom properties of that room with PhotonNetwork.room.SetCustomProperties call. These properties will be updated on every client in room automatically (access them via PhotonNetwork.room.CustomProperties).
    Also clients in lobby will get OnReceivedRoomListUpdate message with RoomInfo containing new properties.
    Put properties names ("scores") in roomOptions.customRoomPropertiesForLobby when creating the room to be able to see them in lobby and get updates on them.