This document is about: PUN 1
SWITCH TO

PUN Classic (v1.x) and Bolt are outdated and will not receive further updates. Of course, existing PUN Classic and Bolt projects will continue to run. New projects should use Fusion or Quantum.

App and Lobby Stats

Photon servers can broadcast application and lobby statistics to clients.
You can make use of this data to enhance your client-driven matchmaking.
You can also brag about these statistics in your game to show how popular it is. :]

Application Statistics

While connected to a Master Server, clients receive application statistics for the current region.

The applications statistics are:

  • Number of live rooms:

    C#

    PhotonNetwork.countOfRooms
    
  • Number of players not joined to rooms:

    C#

    PhotonNetwork.countOfPlayersOnMaster
    
  • Number of players inside rooms:

    C#

    PhotonNetwork.countOfPlayersInRooms
    
  • Total number of connected players:

    C#

    PhotonNetwork.countOfPlayers
    

    AppStats event is sent to client every five seconds.

Lobby Statistics

Lobby statistics can be useful if a game uses multiple lobbies and you want to show the activity.

Lobby statistics are per region.

Per typed lobby (name + type) you can get information about:

  • Number of live rooms
  • Total number of players joined to the lobby or joined to the lobby's rooms

Automatically Get Lobby Statistics

Lobby statistics events are sent as soon as the client is authenticated to a master server.
Then they are sent every minute.
Lobby statistics events are disabled by default.

In PhotonServerSettings, check "Enable Lobby Stats" to get lobby statistics from the server.
This setting was introduced in PUN v1.60.

Check PhotonNetwork.LobbyStatistics to get the cached statistics.
There is also a callback PunBehaviour.OnLobbyStatisticsUpdate that could be useful to update your UI.

Back to top