OnLobbyStatisticsUpdate not updating when a new player joins Master
public override void OnLobbyStatisticsUpdate() { PlayerCount = PhotonNetwork.countOfPlayers.ToString(); }Thanks in advance!
Comments
-
Hi @meatloaf,
Thank you for choosing Photon!
As read in this doc page:AppStats event is sent [to client] every five seconds.Is this the correct way to be doing this?Yes, the first AppStats event is received as soon as the client is connected to Master Server. Then every 5 seconds.0 -
Thanks so much for the response. It doesn't seem to be updating every 5 seconds though.
I connect to master on one client and get a +1 to player count. Connecting another player to master though doesn't seem to +1 player count for the original joiner.
I have stats enabled as well. Just not sure what the problem is.
Thanks!0 -
Maybe players are on different servers (different region) or different virtual applications (different AppId or different AppVersion).0
-
Interestingly I have checked all of those settings and they match across the board. I'm really curious what could be going on here.0
-
After some investigation it looks like this does seem to work, but the update time is definitely not 5 seconds on my end. It looks more to be about a minute or so.
Is there any way to change this update time?
--Edit--
After some searching it looks like this I was right in my assumption that it was about a minute. After searching for "AppStats event is sent [to client] every five seconds." on google I was able to find the link below.
App & Lobby Stats
An excerpt statesLobby statistics events are sent as soon as the client is authenticated to a master server then they are sent every minute.
Still curious if there is a way to change this update time?
Thanks in advance!0 -
Hi @meatloaf,
There are two events:
AppStats: sent every 5 seconds
LobbyStats: sent every minute
You can't change the frequency on Photon Cloud.
You can change this on self-hosted Photon Server or maybe Photon Enterprise Cloud (not sure about the latter).
In any case, I will double check with the team and maybe run few tests for the 5 seconds period.0 -
Hello, I want to get the player count or room count of the different SQL typed lobby I have Separately, But I'm struggling to implement this. "lobbyStatistics[].PlayerCount" this is where I'm getting player count or room count option in "OnLobbyStatisticsUpdate(List<TypedLobbyInfo> lobbyStatistics)" callback function. But I'm not getting how to pass the reference of a particular lobby inside of "[]" this curly braces, or I'm trying to implement this wrong and there's some other method? Kindly help. I have been struggling to get this for weeks. Any help will be appriciated.
Below attaching the ss of what I want to achieve. Thanks in advance
0 -
The lobbyStatistics is a List or array. To find a particular lobby (likely by name), you have to iterate through the list and check each name.
I don't think that the list order is guaranteed (lobbies may be added), so you should update the index after getting new stats.
0