The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Need help. How to enable lobby statistics?

PhoenixRise
2019-03-20 17:43:06

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

Comments

PhoenixRise
2019-03-20 18:00:47

Also I'm using PUN 2

JohnTube
2019-03-21 11:23:42

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 using PhotonNetwork.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 use PhotonNetwork.NetworkingClient.EnableLobbyStatistics = true; before connecting.

PhoenixRise
2019-03-21 16:44:10

Oh ok.ty so much for explaining that.

KapilKhatik
2022-05-06 19:25:56

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.

Back to top