CreateRoom() freezes everything (it worked before)

Options
Suddendly, my game freezes, whenever I click the Play Button. It cant be a problem in my Code, because I didnt change anything. When I skip the "CreateRoom()", then everything works again. (More or less because there is no room). I even tried to use CreateRoom(null), but it also freezes.

// PLAY BUTTON CLICK
public void StartServer ()
{
if (PhotonNetwork.connected) {
Debug.Log ("1");
string[] roomPropsInLobby = { "md"};
ExitGames.Client.Photon.Hashtable customRoomProperties = new ExitGames.Client.Photon.Hashtable ()
{{"md", Settings.GameMode }};
Debug.Log ("2");
roomOpt = new RoomOptions ();
if (Settings.GameMode == 0) {
PlayerCount = 4;
roomOpt.maxPlayers = (byte)4;
} else {
PlayerCount = 6;
roomOpt.maxPlayers = (byte)6;
}
Debug.Log ("3");
roomOpt.customRoomPropertiesForLobby = new string[]{ "md"};
roomOpt.customRoomProperties = customRoomProperties;
Debug.Log ("4");
PhotonNetwork.JoinRandomRoom (customRoomProperties, 0);
Debug.Log ("5");
}
}

void OnPhotonRandomJoinFailed ()
{
Debug.Log ("JOIN FAILED");
PhotonNetwork.CreateRoom (null, roomOpt, null);
}

void OnCreatedRoom ()
{
Debug.Log ("10");
int scene;
PhotonNetwork.room.open = false;
Debug.Log ("11");
if (Settings.GameMode == 0)
scene = UnityEngine.Random.Range (1, 3);
else
scene = UnityEngine.Random.Range (4, 6);
//scene = 3;
Debug.Log ("12");
ExitGames.Client.Photon.Hashtable levelproperty = new ExitGames.Client.Photon.Hashtable ()
{{"le", scene}};
Debug.Log ("13");
PhotonNetwork.room.SetCustomProperties (levelproperty);
Debug.Log ("14");
StartGame (scene);
}

public void StartGame (int scene)
{
Debug.Log ("15");
PhotonNetwork.RemoveRPCsInGroup (0);
PhotonNetwork.RemoveRPCsInGroup (1);
Debug.Log ("LOAD LEVEL");
PhotonNetwork.LoadLevel (scene);
Debug.Log ("TEST");
}

The Log shows:

1
2
3
4
5
Join Failed

So it crashes exactly at CreateRoom(). What can I do? Thanks for the help!

Comments

  • equality
    Options
    I tested it abit more.
    when I build it on Android, it freezes whe I click Play
    when I build it for Windows, the level gets starzed but I am not in a room
    In the editor it freezes either way.

    wierd. I wanna try to delete Photon from the project and import it again. But what is the best way to do it?
  • equality
    equality
    edited January 2016
    Options
    Solved: The problem was not in the main menu scene, even though it seemed so. In the game scene, the Start() function calls PhotonNetwork.Instantiate(character). This was the problem. So I disabled all scripts on the Character prefab, but it still didnt work. Then I disabled the PhotonView and it worked.

    So the PhotonView was the problem. I deleted it from the prefab, added it again, and not it works. :D