0
votes

Now I test my demo game is used the free version that is only 20 ccu. I would like to ask how can I check how many players connect my photon server now. I want to do some waiting function if photon server has 20 players connected. How can I check? Thanks.

1

1 Answers

2
votes

You can get the count of currently online users connected to the lobby with the OnLobbyStatisticsUpdate() callback. Your class must derive from Photon.PunBehaviour.

public override void OnLobbyStatisticsUpdate()
    {
        string countPlayersOnline;
        countPlayersOnline = PhotonNetwork.countOfPlayers.ToString() + " Players Online";
    }

Notice that this update comes with a correct value every 10 seconds (more or less depending on server load).