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 not visible to second client

2012-02-28 17:59:08

Hi, Pretty new to Photon but getting stuck with a second client not seeing a new room. Here is what I have done so far:

  • downloaded the server sdk (version 3) and running a loadbalancer instance (kept the config as is)
  • downloaded the unity plugin
  • added code to my project as per tutorial:

// basic connection if (!PhotonNetwork.connected) PhotonNetwork.ConnectUsingSettings();

The PhotonServerSettings inside Unity are: HostType = SelfHosted ServerAddress = Port = 5055 App ID = Master

// connected event void OnJoinedLobby() { // after we are connected with Photon we end up in the lobby RoomInfo[] rooms = PhotonNetwork.GetRoomList(); for (int i = 0; i < rooms.Length - 1; i++) { if (rooms[i].name == "myRoom") { PhotonNetwork.JoinRoom(rooms[i]); return; } } PhotonNetwork.CreateRoom("myRoom",true, true, 10); }

So my problem is that if I run a build from Unity the first client is all fine and happy, it connects, gets to the lobby and then creates the room and joins this room. I can see all these steps occuring fine.

But when the second client comes online, it can connect to the Photon Server and get to the lobby but doesn't see the room created, and I think it tries to create another room which will obviously fail. Is there another thing I need to be aware of to ensure the room is visible to other clients?

Thanks Dan


2012-02-28 23:02:45

Both clients run on the same machine as the server? And neither is a simulated smartphone? A first look on your code shows nothing wrong. The comparison to "myGame" is certainly for testing?

You could try the Demo Worker on your server and see if that behaves correctly. This would verify the server setup is ok. I can try to find something tomorrow.

2012-02-28 23:34:08


Yes both clients run on same machine, the comparison to myRoom is that I want both clients in the same room. I also have a second debug that prints PhotonNetwork.getRoomList for the second client and it returns nothing. For the second client I do get the void OnJoinedLobby() call so it should be connected to Photon. Is a bit hard to debug given that a single client runs fine and I can't run multiple clients inside Unity debug.

Will have a look at the Demo Worker piece to help troubleshoot this.

Thanks for the help.

2012-03-01 02:32:53

ok, tried to get some more insight. Basically the problem I am having (when using either Cloud or a local Photon server) is that if a first player creates a new room like: PhotonNetwork.CreateRoom("myGame",true, true, 10);

and a second player connects and does (inside the OnJoinedLobby`handler)
RoomInfo[] rooms = PhotonNetwork.GetRoomList(); is doesn't see the myGame room as the array count is empty, but when it tries to create a new room (myGame) it fails: createGame failed, client stays on masterserver: OperationResponse 227: ReturnCode: 32766 (A game with the specified id already exist.). Parameters: {}.

So for some reason my second client / player can't see the new room that was created by the first client / player. I must be missing something here? I have unique playernames for each client and when using the Cloud host they use the same App ID.

Any ideas anyone? Thanks, Dan

2012-03-01 10:09:27

The issue might be that the room list is not necessarily available the moment you joined the lobby. Internally, there are 2 things going on (one after another): You get a result for "join lobby", which completes the operation done in background. Once you got into the lobby you will (soon) get a event with the initial room list. So in OnJoinedLobby, you don't have the room list just yet but know it will be there in a moment.

There is another callback you could implement: OnReceivedRoomList. It's called when the list is available.

2012-03-02 03:02:11


Tried using the OnReceivedRoomList() event but the room list is still empty, but when i just do a joinroom call with the room name it works fine, looks like the getroomlist is simply not working for me. I get the same behaviour in the cloud and my localserver.

Both test clients end up in the same room (because i can see both character prefabs when i run one of the two clients inside Unity debug. The strange i am getting though is that void onPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)

is never called, so the the second client is created (i see the prefab loaded) but it's data e.g. position/rotation is never updated.

Will start a second thread on this second piece to not mess up the thread. So the getroomlist remains empty although the second client can definitly see the room and even connect but not via getroomlist?! Dan

2012-03-02 09:52:22

If neither cloud nor your own server list the rooms correctly, I'd guess that your client somehow messes up. Please export your project, write up what we have to do to run it (if anything) and send it to [email protected]

It will take a bit of extra time to check, cause next week we're at the GDC.

2012-03-02 10:04:11

Use OnReceivedRoomListUpdate() instead. It works for sure. :) I think I had some trouble with OnReceivedRoomList() as well, but can't remember what it was.

2012-03-05 23:14:31


I also get this problem regarding an empty PhotonNetwork.GetRoomList(). Even the DemoWorker example project doesn't provide useful results - 2 Clients join the lobby, Client 1 creates a room, Client 2 can't see it. Seems like something was changed in a previous version... once Client 2 joins the room (via JoinRoom("name") - the room actually exists) and leaves it afterwards, the room shows up in the lobby - containing 1 player (Client 1). The documentation says "This list is updated in near-real time", but it stays empty for minutes...

Edit: I upgraded to Photon v3-0-19-2868-RC8 and the problem is gone, now it displays new rooms "near-real time". However, Photon runs on my local machine and I get a ping higher than 20, also all player or game counts does not return any values, my gui always displays "Players: 0 Players on Master: 0 Games: 0". I'm running the DemoWorker example with PUN 1.9, but that's another problem. (I fixed the methods as described here, I will wait for the next update.)

2012-03-14 12:33:40

Earlier versions of the server SDK sometimes didn't update the room list. In RC8 this should be fixed.

About the stats: The server app in the SDK is a bit different from that used in the cloud, to make it simpler to understand and use. For some reason, the LoadBalancing application does not send the necessary event yet.

We will check this and if necessary fix it.

2014-11-12 01:40:27

I too was getting this. As JakobOerum stated, put your list code in:

void OnReceivedRoomListUpdate() { //List here. }

The "OnReceivedRoomList()" that Tobias recommends does not work. This is using the latest SDK/PUN. Using Load Balancing (Cloud) on the Server.

2014-11-12 13:35:59


There is no such thing as OnReceivedRoomList in current SDK. OnReceivedRoomListUpdate should be used. But this message works only while client connected to the lobby.

Back to top