- Home /
Photon Networking (Viking Demo) - GetRoomList() func not working
Hi guys, I am working on Photon Unity Networking package and found an issue that their GetRoomList() function not working. It's not like the issue someone has posted before (http://answers.unity3d.com/questions/527438/photon-networking-getting-roomlist-inside-a-room.html). But it simply cannot display all the rooms available at the start of its Viking Demo. The thing is I run this demo in the editor and create a room called "myRoom111". And I opened a webplayer of this demo, but the room list on the main page is still showing "no games available". However, when I enter "myRoom111" and clicked "Go" to join this room, it worked! So it is not likely to say this room doesn't exist.
Is there anything wrong with my network setting? Should I do something in the Photon Network Account?
Please help me out, please guys.....
Answer by tobiass · Sep 08, 2015 at 09:41 AM
It might be related to the "Auto Join Lobby" setting, which is in the PhotonServerSettings.
With the release of PUN v1.60, the default for AutoJoinLobby is false. Due to that, PUN calls OnConnectedToMaster() when you can create/join/match rooms. Without joining the lobby, PUN will not call OnJoinedLobby() as usual before and GetRoomList() will return an empty list.
AutoJoinLobby can now be set in the PhotonServerSettings file in the project.
When you import PUN into existing projects, you need to make this setting one time. Updating PUN will keep the PhotonServerSettings, so you don't need to touch this setting again.
Answer by NickP_2 · Sep 08, 2015 at 09:46 AM
Make a method in a class inherited from Photon.Punbehavior
named OnReceivedRoomListUpdate()
. This method will get called whenever a change is made in the server list.