JoinRandomRoom does work in editor, not in finished build

Options
I use this logic to create a room for two players:

void Awake () {
PhotonNetwork.ConnectUsingSettings("v0.1");
PhotonNetwork.autoJoinLobby = false;
}

void OnConnectedToMaster() {
PhotonNetwork.JoinRandomRoom();
}

void OnPhotonRandomJoinFailed() {
PhotonNetwork.CreateRoom(null, true, true, 2);
}

This works without a problem but only in Unity 5 editor. In the standalone game (Windows x86 build), I receive this error:

"JoinRandomRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster."

Is this a bug? What can I do now to solve this problem? I installed the latest version of PUN free for Unity by the way.

Comments

  • vadim
    Options
    Why don't you join to lobby?
    OnConnectedToMaster documentation states that it "called after the connection to the master is established and authenticated but only when PhotonNetwork.autoJoinLobby is false."
    Did you set PhotonNetwork.autoJoinLobby to false. For what reason?
    Conventional approach is to joint lobby and handle OnJoinedLobby.
  • Slowin
    Options
    vadim wrote:
    Why don't you join to lobby?
    OnConnectedToMaster documentation states that it "called after the connection to the master is established and authenticated but only when PhotonNetwork.autoJoinLobby is false."
    Did you set PhotonNetwork.autoJoinLobby to false. For what reason?
    Conventional approach is to joint lobby and handle OnJoinedLobby.

    I have tried both. Right now, I'm just joining the lobby and on OnJoinedLobby I try to randomly join a room, but the problem persists.

    Only in editor the game is joining or creating a room, but in the finsihed build I receive the error message (one out of ten times or so it does work here as well though).
  • vadim
    Options
    Do PUN demos work for you when exported as standalone?
    Most of them use PhotonNetwork.autoJoinLobby = false / OnConnectedToMaster approach (UtilityScripts/ConnectAndJoinRandom.cs) as you initially posted while some of them use OnJoinedLobby()
  • Tobias
    Options
    You can add the "SupportLogger" component to your game (a scene which is open before connect) and send us the log. Maybe we see something.