Unable to Join Same Lobby PUN 2

Options
Hi,
I am developing 2D Multiplayer Game and there is nothing wrong with the create lobby.
But when it comes to join a lobby those problem occurs:
1- In Unity Editor IT WON'T Find the lobby.
2- In IOS Platform I can create lobby but builded Windows version find that lobby but when i press join my ios app crashing and Windows version not joining.
3- When I create lobby from Windows Build and trying to join from IOS Build, IOS build crashing.
4- When i Try to join with iPad to iphone same thing happens when someone join the lobby the existing player's just crashing.

And I don't know why in Unity Editor Doesn't even find the lobby.
This is my code:

public void OnClickConnectToMaster()
    {
        nick.text = tmNickName.text;
        strNick = tmNickName.text;
        PhotonNetwork.NickName = tmNickName.text;
        TouchScreenKeyboardType.Default, true, false, true, true);
        PhotonNetwork.OfflineMode = false; 
        tryConnectCloud = true;

        PhotonNetwork.ConnectUsingSettings();           //automatic connection based on the config file in Photon/PhotonUnityNetworking/Resources/PhotonServerSettings.asset

    }
    public override void OnConnectedToMaster()
    {
        base.OnConnectedToMaster();
        tryConnectCloud = false;
        Debug.Log("Connected to Master!");
    }

    public override void OnDisconnected(DisconnectCause cause)
    {
        base.OnDisconnected(cause);
        tryConnectCloud = false;
        tryConnectLobby = false;
        Debug.Log(cause);
    }

    public void OnClickConnectToRoom()
    {
        if (!PhotonNetwork.IsConnected)
            return;

        tryConnectLobby = true;
        Debug.Log("Room Created:" + tmLobbyInput.text);
        if (tmLobbyInput.text == "")
        {
            Debug.Log("BUT RANDOM");
            PhotonNetwork.CreateRoom(null, new RoomOptions { MaxPlayers = 20 });
        }
        else
        {
            Debug.Log("NORMAL");
            PhotonNetwork.CreateRoom(tmLobbyInput.text); //Create a specific Room - Error: OnCreateRoomFailed
        }
       
    }
    public void OnClickJoinToRoom()
    {
        if (!PhotonNetwork.IsConnected)
            return;
        tryConnectLobby = true;
        string lobi = tmLobbyInput.text;
        if (tmLobbyInput.text == "")
        {
            Debug.Log("Joining Random");
            PhotonNetwork.JoinRandomRoom();
        }
        else
        {
            Debug.Log("Joining Normal="+tmLobbyInput.text);
            PhotonNetwork.JoinRoom(lobi);
        }

    }
    
    public override void OnJoinRandomFailed(short returnCode, string message)
    {
        base.OnJoinRandomFailed(returnCode, message);
        PhotonNetwork.CreateRoom(null, new RoomOptions { MaxPlayers = 20 });
    }
    

    public override void OnJoinRoomFailed(short returnCode, string message) {
        base.OnJoinRoomFailed(returnCode, message);
        Debug.Log("Can't FIND ROOM SO CREATED ONE");
        PhotonNetwork.CreateRoom(null, new RoomOptions { MaxPlayers = 20 });
    }

    public override void OnCreateRoomFailed(short returnCode, string message)
    {
        base.OnCreateRoomFailed(returnCode, message);
        Debug.Log(message);
        base.OnCreateRoomFailed(returnCode, message);
        tryConnectLobby = false;
    }

    public override void OnJoinedRoom()
    {
        base.OnJoinedRoom();
        tryConnectLobby = false;

        Debug.Log("Master: " + PhotonNetwork.IsMasterClient + " | Players In Room: " + 
        PhotonNetwork.CurrentRoom.PlayerCount + " | RoomName: " + PhotonNetwork.CurrentRoom.Name);

        if (PhotonNetwork.IsMasterClient && SceneManager.GetActiveScene().name != "Main")
            PhotonNetwork.LoadLevel("Source");
    }
}
Can Someone Help me with that issue ? What is wrong with my code am i doing something awkward ?

Comments

  • hal0000
    Options
    Okay, When i Created Lobby on Builded Windows Version it's seems normal. When i try to join lobby from Unity Editor it will destroy the object and making bug.

  • hal0000
    Options
    Can anyone help me ?
  • Hi @hal0000,

    1- In Unity Editor IT WON'T Find the lobby.


    If you use the Best Region feature, please make sure, that all clients connect to the same region. While developing, you can also use a fixed region. For more information about that problem, please take a look at the Best Region Considerations.

    For the problems 2 - 4 I'm asking you to take a look at the logs of the crashed applications. I didn't notice any problems in the source code you provided.

    Please note, that - in terms of Photon - there is a different between a Lobby and a Room. I guess that you have problems with joining the same room, don't you?
  • Qianfulong
    edited May 2019
    Options
    Hi,
    did you ever find out what the problem was? Because i have a similar problem with my test scene/game, though i'm having the crashing issue even on the same machine when running a windows build and at the same time get into play mode of the unity editor. Whichever game instance was created first (windows build or editor), as soon as the second game instance starts then the first one crashes. What's strange about that is that the same code worked with PUN CLASSIC but after migrating the code to PUN2 the issue appears, so either something changed for PUN2 logically that i am not aware of or it's a PUN2 related issue.
    Any feedback really appreciated