Problem join room

Options
Hi guys i have a little problem with this code, i can create a room but when i try to catch the name of the room in the function Crea_o_Entra_in_partita looks like there is no room open even if a room exist, Any idea where the problem is? Here is the code: `

using UnityEngine; using System.Collections; using System.Collections.Generic;

public class Play_manager : MonoBehaviour
{

public bool solo;
public bool group;

public string Room_Name = "";

public bool five_vs_five;
public bool three_vs_three_vs_three;
public bool four_vs_four;
public bool five_vs_five_d;
public bool three_vs_three;

public string five = "5vs5";
public string three = "3vs3vs3";
public string four = "4vs4";
public string fived = "5vs5d";
public string six = "3vs3";


public GameObject invite5vs5;
public GameObject invite3vs3vs3;
public GameObject invite4vs4;
public GameObject invite5vs5d;
public GameObject invite3vs3;

public string roomNameprov;

// Use this for initialization
void Start()
{


}

// Update is called once per frame
void Update()
{
if(!PhotonNetwork.connected)
{
PhotonNetwork.ConnectUsingSettings("1");
PhotonNetwork.playerName = Random.Range(0, 100).ToString();
}

}


public void Crea_o_Entra_in_PArtita()
{


//////////SE IN SOLO//////////////
if (solo && five_vs_five)
{

foreach(RoomInfo room in PhotonNetwork.GetRoomList())
{
if (room.name.Contains(five) && PhotonNetwork.room.playerCount < PhotonNetwork.room.maxPlayers)
{
roomNameprov = room.name;
if (roomNameprov != "")
{
PhotonNetwork.JoinRoom(roomNameprov);
return;
}
}
}

}

if (solo && three_vs_three_vs_three)
{
foreach (RoomInfo room in PhotonNetwork.GetRoomList())
{
if (room.name.Contains(three) && PhotonNetwork.room.playerCount < PhotonNetwork.room.maxPlayers)
{
if (roomNameprov != "")
{
PhotonNetwork.JoinRoom(roomNameprov);
return;
}
}
}
}

if (solo && four_vs_four)
{
foreach (RoomInfo room in PhotonNetwork.GetRoomList())
{
if (room.name.Contains(four) && PhotonNetwork.room.playerCount < PhotonNetwork.room.maxPlayers)
{
if (roomNameprov != "")
{
PhotonNetwork.JoinRoom(roomNameprov);
return;
}
}
}
}

if (solo && five_vs_five_d)
{
foreach (RoomInfo room in PhotonNetwork.GetRoomList())
{
if (room.name.Contains(fived) && PhotonNetwork.room.playerCount < PhotonNetwork.room.maxPlayers)
{
if (roomNameprov != "")
{
PhotonNetwork.JoinRoom(roomNameprov);
return;
}
}
}
}

if (solo && three_vs_three)
{
foreach (RoomInfo room in PhotonNetwork.GetRoomList())
{
if (room.name.Contains(six) && PhotonNetwork.room.playerCount < PhotonNetwork.room.maxPlayers)
{
if (roomNameprov != "")
{
PhotonNetwork.JoinRoom(roomNameprov);
return;
}
}
}
}


////////////SE IN GRUPPO////////////



if (group && five_vs_five)
{
string room_name1 = five + PhotonNetwork.playerName + Random.Range(0, 10000);
RoomOptions roomOptions1 = new RoomOptions() { isOpen = true, maxPlayers = 2 }; ////////
PhotonNetwork.CreateRoom(room_name1, roomOptions1, TypedLobby.Default);


Debug.Log("ho creato e sono dentro una stanza");

invite5vs5.SetActive(true);

}

if (group && three_vs_three_vs_three)
{
string room_name2 = three + PhotonNetwork.playerName + Random.Range(0, 10000);
RoomOptions roomOptions2 = new RoomOptions() { isOpen = true, maxPlayers = 2 };
PhotonNetwork.CreateRoom(room_name2, roomOptions2, TypedLobby.Default);
Debug.Log("ho creato e sono dentro una stanza");

invite3vs3vs3.SetActive(true);


}

if (group && four_vs_four)
{
string room_name3 = four + PhotonNetwork.playerName + Random.Range(0, 10000);
RoomOptions roomOptions3 = new RoomOptions() { isOpen = true, maxPlayers = 2 };
PhotonNetwork.CreateRoom(room_name3, roomOptions3, TypedLobby.Default);
Debug.Log("ho creato e sono dentro una stanza");

invite4vs4.SetActive(true);

}

if (group && five_vs_five_d)
{
string room_name4 = fived + PhotonNetwork.playerName + Random.Range(0, 10000);
RoomOptions roomOptions4 = new RoomOptions() { isOpen = true, maxPlayers = 2 };
PhotonNetwork.CreateRoom(room_name4, roomOptions4, TypedLobby.Default);
Debug.Log("ho creato e sono dentro una stanza");

invite5vs5d.SetActive(true);

}

if (group && three_vs_three)
{
string room_name5 = six + PhotonNetwork.playerName + Random.Range(0, 10000);
RoomOptions roomOptions5 = new RoomOptions() { isOpen = true, maxPlayers = 2 };
PhotonNetwork.CreateRoom(room_name5, roomOptions5, TypedLobby.Default);
Debug.Log("ho creato e sono dentro una stanza");

invite3vs3.SetActive(true);

}
}

}
Any idea where is the problem? Thanks to all

Comments

  • Tobias
    Options
    Sorry for not replying at all. Are you still stuck or did you figure out what's happening?

    In general, it's often tricky for us to debug code. It takes a while and we're busy getting updates out, supporting more platforms, etc. :)
    So, always do your best to debug stuff like this. Add Debug.Log in many places to make sure things are called as you expect.

    If you expect a room list, you only get those while being in one of Photon's lobbies. In the PhotonServerSettings, you find a checkbox for "auto join lobby". Is that related?