OnRoomListUpdate returns rooms that have been closed when master client closes game (PUN2)
Options
Hi,
I've been going through the forums looking for someone that has faced a similar situation as I am now, but I couldn't find anything. Sorry if there has been.
I'm using PUN2 and OnRoomListUpdate() to get available rooms for the client, I am caching these results.
1.Whenever a new room pops up there is no issue, and is shown in game.
2. However, when one of the master clients of the room decides to close the game (either from Alt + F4 or just by closing the window). OnRoomListUpdate() will be called at that instance for other clients in Lobby, but the roomList it returns will still return the closed room as open.
3. I'm having difficulty removing it from my cached list as OnRoomListUpdate is not called again unless a new room is opened or the client exits the lobby and join again. Only then does it show that the room has been closed and I can remove it.
What should I do?
Thanks in advance for anyone that can help me
I've been going through the forums looking for someone that has faced a similar situation as I am now, but I couldn't find anything. Sorry if there has been.
I'm using PUN2 and OnRoomListUpdate() to get available rooms for the client, I am caching these results.
1.Whenever a new room pops up there is no issue, and is shown in game.
2. However, when one of the master clients of the room decides to close the game (either from Alt + F4 or just by closing the window). OnRoomListUpdate() will be called at that instance for other clients in Lobby, but the roomList it returns will still return the closed room as open.
3. I'm having difficulty removing it from my cached list as OnRoomListUpdate is not called again unless a new room is opened or the client exits the lobby and join again. Only then does it show that the room has been closed and I can remove it.
What should I do?
Thanks in advance for anyone that can help me
0
Comments
-
Oh I forgot to mention but I am more than happy to post my code if it will help with debugging. Thanks!1
-
Hello, i was working on a Room Overview and have to say it works like it should.
Please post your Code.
Here a snippet
https://pastebin.com/R9hsVrFu
1 -
Hey, I've been going through your code and it looks fine to me. But for some reason my roomlist doesn't show any rooms that have been removed from list.
I've attached my code that is responsible for this purpose
https://pastebin.com/tEawH06F0 -
Hey @JohnTube ,
the RoomPanels refresh on it self, but thanks.
@Hurbivore
It seems you overcomplicating things in your script.
Take a look in the Demo or just look closer at the snippet i posted.
OnRoomListUpdate wors like expected.0 -
Hi @S_Oliver,the RoomPanels refresh on it selfI don't think so. The new updated RoomInfo is never passed to the RoomPanels so it can't get the new values.
OnRoomListUpdate
sends you updates whenever RoomInfo values of existing/old rooms change. You need to use those new RoomInfo to override old ones. Examples: room is closed, players count change, etc. You can't get that from elsewhere other thanOnRoomListUpdate
.
0 -
Change the if else statement in OnRoomListUpdate to
if (room.RemovedFromList == false) { Debug.Log("room is open"); } else { Debug.Log("Room has been removed from list"); }
1 -
Thanks that worked!0