JoinRoom failed

Options
Hello,

I'm using this JavaScript code:

[code2=javascript]for (var game : RoomInfo in PhotonNetwork.GetRoomList())
{
if(GUILayout.Button(game.name + " - " + game.playerCount + "/" + game.maxPlayers + " " + "Ping: " + PhotonNetwork.GetPing()))
{
PhotonNetwork.JoinRoom(game.name);
Application.LoadLevel("level1");
}
}[/code2]

My problem is that it can't join the room, it says to specify a roomname.
How can I fix this problem?

Thank you in advance. :)

Comments

  • Tobias
    Options
    You could log the value of game.name. Maybe it's empty in this case? The room list is empty in most cases while you test (as no room is created).
    JoinRoom always needs a string as room name to join, so make sure it's not null or "".
  • I try to join a room that I previously created.
  • Tobias
    Options
    Did you try what I suggested?
    A player / client who creates a room will automatically join it. No need to join explicitly.