The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Room is still visible when it should not

2017-09-19 07:17:35

Hi everyone,

First of all I would like to thank the whole Exitgames team for this wonderful and powerful Unity plugin which is PUN.

We are however stuck on an issue we cannot find a solution of:
A room that has been set NotVisible is still retrieved by other players inside the lobby.

This is our code:

  1. Masterclient set the room IsVisible = false when max number of players is reached:
if(PhotonNetwork.playerList.Count() ==  
        if (PhotonNetwork.player.IsMasterClient == false)  
        return; = false;  = false;  
  1. Player in lobby press the refresh button, clear all the rooms UI and repopulate it:
public void OnRoomListRefresh()  
	// Clear the List  
	clearRoomsList ();

	// Populate Room List  

void clearRoomsList()  
	foreach (Transform child in g_oRoomsListPanel.transform)  

// Populate the available rooms list  
void populateRoomsList()  
	foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList ())  
		if(roomInfo.IsVisible == true)  

The problem is that the room, which has been set not visible by the masterclient is still added inside the UI rooms list.
Furthermore, when I print the roominfo.playercount of that particular room, it shows me one player less.
(Eg. inside the room there are 2 players, however inside lobby it tells me there is only 1)

Any idea of what it could be the issue here?
Inside the game room.IsVisible is definitely false as I am printing it on the console.

Kind regards,


2017-09-19 08:25:45

Hi @Pier,

Thank you for choosing Photon and for your kind words.

This is probably due to the frequency of rooms list updates events.
While PUN updates rooms list in the background for you automatically when it receives new list from server, this may not happen as often as you think.
The update can be logged using a special callback (OnReceivedRoomListUpdate), so you should replace button refresh logic with:

private void OnReceivedRoomListUpdate()   

2017-09-20 03:25:52

Thanks John for your prompt reply.

I have tried your suggestion however the outcome is the same as using our current logic (refresh button).

What I have noticed is that the call back "OnReceivedRoomListUpdate" is not triggered when a room reaches maximum capacity and therefore is closed ( = false; = false;) by masterclient.

To test the logic, I created a room with max capacity of 4 players and used my laptop to print Debug.Log("OnReceivedRoomListUpdate");

When the room is created, there is the first callback.
A second player joins this room and the callback is fired again.
Same with the third player; "OnReceivedRoomListUpdate" is fired as expected.
However, when the fourth and last player joins the room and therefore room is closed by masterclient because room has reached max capacity and game is about to start, OnReceivedRoomListUpdate() is NOT fired and the room is still listed in lobby showing 3/4 players.
And of course if a fifth player presses the join button on that particular room, PUN fires an error saying that the room has been closed.

Thanks in advance for your time and support.

Kind Regards,

2017-09-20 17:26:40

Hi @Pier I could not reproduce this issue.
Can you give us repro project, video, gif, screenshots or logs?

2017-09-21 08:28:05

Dear John, I have finally SOLVED the issue!

As I am connecting to a LobbyType.SqlLobby, what I needed was to add this check before calling GetRoomList():

if(PhotonNetwork.GetCustomRoomList(m_oSqlLobby, m_sSqlLobbyFilter) == false)

foreach( RoomInfo room in PhotonNetwork.GetRoomList() )
if(room.IsOpen == true)

Now the closed room is finally NOT displayed inside the lobby.

I take this opportunity to wish you and the whole Exitgames team and community all the very best.
Keep up the amazing job you are doing!


Back to top