Need help. How to enable lobby statistics?
Options
Hello, I want to use the OnLobbyStatisticsUpdate() function. But the documentation says you have to enable lobby statistics. The docs say do this:
PhotonNetwork.EnableLobbyStatistsics = true;
(Which is read only)
And this:
LoadBalancingClient.EnableLobbyStatistics = true;
(Which gives the error "an object reference is required")
I've also tried:
PhotonNetwork.PhotonServerSettings.EnableLobbySatistics
PhotonNetwork.EnableLobbyStatistsics = true;
(Which is read only)
And this:
LoadBalancingClient.EnableLobbyStatistics = true;
(Which gives the error "an object reference is required")
I've also tried:
PhotonNetwork.PhotonServerSettings.EnableLobbySatistics
0
Best Answer
-
Hi @PhoenixRise,
Thank you for choosing Photon!
The proper way to enable lobby stats in PUN2 is, as shown in the docs page here:In PhotonServerSettings, check "Enable Lobby Stats" to get lobby statistics from the server.If you want to do it from code before connecting:PhotonNetwork.PhotonServerSettings.EnableLobbySatistics = true;
These work when you connect usingPhotonNetwork.ConnectUsingSettings();
as that's the only connect method that actually makes use of the ScriptableObject ServerSettings.
If you need to use another connect method, then you should usePhotonNetwork.NetworkingClient.EnableLobbyStatistics = true;
before connecting.5
Answers
-
Also I'm using PUN 20
-
Hi @PhoenixRise,
Thank you for choosing Photon!
The proper way to enable lobby stats in PUN2 is, as shown in the docs page here:In PhotonServerSettings, check "Enable Lobby Stats" to get lobby statistics from the server.If you want to do it from code before connecting:PhotonNetwork.PhotonServerSettings.EnableLobbySatistics = true;
These work when you connect usingPhotonNetwork.ConnectUsingSettings();
as that's the only connect method that actually makes use of the ScriptableObject ServerSettings.
If you need to use another connect method, then you should usePhotonNetwork.NetworkingClient.EnableLobbyStatistics = true;
before connecting.5 -
Oh ok.ty so much for explaining that.0
-
How to implement this code to show no. of active players in the current lobby? I'm confused about how to implement this? Can you guide me with some resources? It'll be very helpful to me thanks.
0