PUN Classic (also called PUN1) is the original and first major version of PUN. It is now replaced by PUN2 which is refactored and enhanced. We highly recommend starting new projects with PUN2 and if possible migrating existing ones from PUN1 to PUN2 by following our "Migration Notes". PUN Classic will be maintained for the coming months. We will fix important bugs and support new Unity versions but new features will be added only to PUN2.

App and Lobby Stats

Photon servers can broadcast application and lobby statistics to clients. You can make use of this data to implement a complex custom matchmaking system. You can also brag about these statistics in your game to show how popular it is. :]

Application Statistics

When connected to a Photon master server, a Photon client receives applications statistics. Regardless of whether the client is joined to a lobby or not, it will receive AppStats events.

The applications statistics are:

  • Number of live rooms:

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

        PhotonNetwork.countOfPlayersOnMaster
  • Number of players inside rooms:

        PhotonNetwork.countOfPlayersInRooms
  • Total number of connected players:

        PhotonNetwork.countOfPlayers

    AppStats event is sent to client every five seconds.

Back To Top

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

Back To Top

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.

To Document Top