Problem with PhotonNetwork.GetCustomRoomList

The whole answer can be found below.

Please note: 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! And we offer you support through these channels:

Try Our
Documentation

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.

Read More on
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.

Problem with PhotonNetwork.GetCustomRoomList

kanowins
2019-09-23 08:37:04

Hello, I can't make it work for any reason. I'm sure I'm missing something but I can't figure it out:

  • First time I call to FindPrivateRoom (calls to GetCustomRoomList) it works fine, no rooms are found and it creates the room with the roomCode.
  • I think I'm creating the room with the CustomRoomProperties and CustomRoomPropertiesForLobby fine.
  • Next call to GetCustomRoomList with de "roomCode" it fails and returns this error:

"GetGameList failed: Operation response 217. Return code -2 (SQL logic error or missing database
no such column: roomCode). Parameters: {}

I followed the example on https://doc.photonengine.com/en-us/pun/v2/lobby-and-matchmaking/matchmaking-and-lobby

The code is the next:

private TypedLobby _defaultLobby = new TypedLobby("myLobby", LobbyType.SqlLobby);  
private static string ROOM_CODE = "roomCode";

public void CreateRoom(string strName, string strRoomCode)  
        {  
            RoomOptions roomOptions = new RoomOptions();  
            roomOptions.MaxPlayers = this.maxPlayersPerRoom;  
            roomOptions.CustomRoomProperties = new Hashtable { { ROOM_CODE, strRoomCode } };  
            roomOptions.CustomRoomPropertiesForLobby = new string[]{ ROOM_CODE };  
            PhotonNetwork.CreateRoom(strName, roomOptions, _defaultLobby);  
        }

 public void FindPrivateRoom(string strRoomCode)  
        {  
            PhotonNetwork.GetCustomRoomList(_defaultLobby, ROOM_CODE + " = '" + strRoomCode + "'");  
        }

public override void OnRoomListUpdate(List roomList)  
        {              
                // create or join to password room  
                foreach (RoomInfo info in roomList)  
                {  
                    // is a join, find an opened room and join  
                    if (info.IsOpen)  
                    {  
                        Debug.Log("room already open")  
                        return;  
                    }  
                }  
               // no room found, create it  
                CreateRoom(null, currentRoomName);  
        }

Anyone can find what is happening?

Thank you!

Comments

kanowins
2019-09-23 09:28:31

I figured out what is happening. The problem was the field name "roomCode". I have changed this line and everything is working fine now.

private static string ROOM_CODE = "C0";

Back to top