PhotonNetwork.CurrentRoom.RemovedFromList = true - not working

I am making a room list by instantiating UI elements, with the room name, and a button to create or join. Everything works great, but I am having trouble removing the room from the list once both players are in the game.

This is a 2-player game, the first player enters the room name, and a room is automatically created and joined. When the second player starts the game, they see the room in the list with a button to join the room created by the first player.

What I want to do is remove the room from the list in case other players start the game. Both players are already in the game and the room shouldn't end up in the list.

I am doing a test in the loop that instantiates the Room UI elements that checks for "RemovedFromList" before it adds the room item.

On the function that I attach to the button to join a room I added:

PhotonNetwork.CurrentRoom.RemovedFromList = true;

However, when a third player enters, the room is still being listed. Any thoughts on how to improve are appreciated.

Comments

  • Tobias
    Tobias admin
    edited November 2022

    RemovedFromListis readonly for the client, as it's set by the server. A lobby list update may set this true for rooms that are no longer listed (so you update your ui to not show them).

    Clients in rooms won't get room list updates, so for them you can consider the complete list invalid.

    To delist a room for everyone else, set Room.IsVisible = false and or close the room via Room.IsOpen = false so nobody can join anymore.