GetRoomList Error for new Clients

When a new client joins the lobby and a room is already created, it gives me this error:
InvalidCastException: Cannot cast from source type to destination type.

I'm just using this:
void OnGUI()
{
    foreach (Room game in PhotonNetwork.GetRoomList())
    {
        GUILayout.Label(game.name + " " + game.playerCount + "/" + game.maxPlayers);
    } 
}

Comments

  • void OnGUI()
    {
        foreach (RoomInfo game in PhotonNetwork.GetRoomList())
        {
            GUILayout.Label(game.name + " " + game.playerCount + "/" + game.maxPlayers);
        } 
    }
    

    I think should be RoomInfo instead of Room in your foreach loop
  • xhtai4 wrote:
    I think should be RoomInfo instead of Room in your foreach loop
    Thank you so much. It seems to be working now
Sign In or Register to comment.