Others' rooms being removed if I create a room and then leave it (PUN2)
Options
Basically, if player X makes a room, it shows up fine on player Y's screen. The issue occurs when player Y creates a room and then leaves it. When he returns to the lobby listing, two OnRoomListUpdates are received. One shows player X's room fine, but then another OnRoomListUpdate is received about a half second later that marks player X's room as having 0 players and RoomInfo.RemovedFromList being true. I'm trying to figure out why this is or if there is any way I could be causing this to happen from my side.
What I've essentially set up is that, when OnRoomListUpdate is called, I clear all of the current room listings, and then I instantiate a room button for each RoomInfo that was received. Seems like a pretty foolproof way to do it, but is this somehow causing this bug that I am experiencing? Thank you.
A little more info: When I leave a room, I call PhotonNetwork.LeaveRoom() (obviously), and then once the OnLeftRoom callback is received, I call PhotonNetwork.JoinLobby(). But when I join the lobby, player X's room is being removed for some reason.
What I've essentially set up is that, when OnRoomListUpdate is called, I clear all of the current room listings, and then I instantiate a room button for each RoomInfo that was received. Seems like a pretty foolproof way to do it, but is this somehow causing this bug that I am experiencing? Thank you.
A little more info: When I leave a room, I call PhotonNetwork.LeaveRoom() (obviously), and then once the OnLeftRoom callback is received, I call PhotonNetwork.JoinLobby(). But when I join the lobby, player X's room is being removed for some reason.
0
Comments
-
Bump0
-
Hi @matthewjd24,
By design empty rooms are removed after EmptyRoomTTL.
Default EmptyRoomTTL is 0 millisecods.
Max allowed value for EmptyRoomTTL on public Photon Cloud is 5 minutes (300000 ms).
EmptyRoomTTL can be set during room creation (roomOptions.EmptyRoomTtl) or changed after that (room.EmptyRoomTtl).
We have a snippet of how to handle and maintain lobbies rooms list here.0 -
Thank you for the reply @JohnTube , unfortunately, my problem is that if I create a room and then leave it, once I rejoin the lobby, another player's room (which is still open and visible) disappears. I'm not sure why. I will take a look of your snippet and see if the way I've set it up may be an issue0
-
Well I replaced my code with the one in the example and it fixed the issue. I'm not sure what I did wrong but as long as it's fixed Thanks!0