When will onroomlistupdate() be called?

When is the onroomlistupdate() function of PuN2 called? Isn't it called when the room list is updated? But after Deugging, I found that it was only called when I called the JoinLobby () function in the initial Login (). It has not been called when I joined or created a room, then I called LeaveLobby () in LeaveRoom (), and called JoinLobby () again.But it's still not called

Comments

  • JohnTubeJohnTube mod
    edited May 9
    Hi @Lhiker,

    Thank you for choosing Photon!

    OnRoomListUpdate callback is called in two cases:

    - when client receives GameList event received when joining lobby of type default.
    - when client receives GameListUpdate event when joined to a lobby of type default and one or more rooms inside the lobby change one one of more of its properties visible to the lobby (IsOpen, IsVisible, PlayerCount, MaxPlayers or custom room properties explicitly exposed to the lobby).

    EDIT, UPDATE:

    Ah yes, I forgot one more case:

    OnRoomListUpdate will be called as a result of op GetGameList for SQL Lobbies (PhotonNetwork.GetCustomRoomList)
  • Thanks for the response @JohnTube mod,
    Do you mean to say when I coded PhotonNetwork.CurrentRoom.IsVisible = false; OnRoomListUpdate callback will be called? I think it might be, but there is error,Operation GetGameList (217) not allowed on current server (GameServer)。Can you tell me why?
  • Ah yes, I forgot one more case:

    OnRoomListUpdate will be called as a result of op GetGameList for SQL Lobbies (PhotonNetwork.GetCustomRoomList)

    PhotonNetwork.GetCustomRoomList can be called only when connected to master server, outside of rooms.
  • LhikerLhiker
    edited May 9
    I seem to know what the problem is. When I join or create a room, I will automatically exit the lobby. At this time, I can not update the room list unless I join the lobby again. I always thought that after leaving the room, I was still in the lobby, which led to the error。In the end, thanks for your help again.
  • Lhiker wrote: »
    I seem to know what the problem is. When I join or create a room, I will automatically exit the lobby. At this time, I can not update the room list unless I join the lobby again. I always thought that after leaving the room, I was still in the lobby, which led to the error。In the end, thanks for your help again.
    So, how can I solve this? I stepped on this pit recently, thank you
  • LhikerLhiker
    edited May 18
    Have you solved the problem? If not, here is my solution. You can call PhotonNetwork.JoinLobby() in OnConnectedToMaster(). Client will call OnConnectedToMaster after leaving the room, and thus client will join lobby at the same time.
Sign In or Register to comment.