Send message between different rooms
Options
Comments
-
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.0 -
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 again0 -
You can use single "scores" custom property:
"scores" : {
"player1" : 10
"player2"
...
}
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.0