Search Unity

Try Catch Not Working When Joining a Game.

Discussion in 'Multiplayer' started by Daniel25097, Apr 28, 2016.

  1. Daniel25097

    Daniel25097

    Joined:
    Nov 10, 2015
    Posts:
    16
    Hi all,
    I'm adding a matchmaker system to my game,and also the possibilty to secure your room with password.
    The problem is when im using the Try Catch mechanism it does not seem to work.
    Code (CSharp):
    1.    
    2. public void UIJoin(int index)
    3.     {
    4.         try {
    5.  
    6.             //Trying to join the match with no password, assuming there is no one.
    7.  
    8.             GuiLobbyManager.s_Singleton.matchMaker.JoinMatch(
    9.               GuiLobbyManager.s_Singleton.matches[index].networkId,
    10.               "",
    11.               GuiLobbyManager.s_Singleton.OnMatchJoined);
    12.         }
    13.         catch
    14.         {
    15.            // Creates a panel with input field for the password, and a button to connect again.
    16.  
    17.             if(needPassword == null){
    18.                 needPassword = (GameObject)GameObject.Instantiate(needPasswordPrefab, Vector3.zero, Quaternion.identity);
    19.             }
    20.         }
    21.     }
    Although the catch, i'm getting this exception:

    Code (CSharp):
    1.  
    2. Join Failed:[[UnityEngine.Networking.Match.JoinMatchResponse]-success:False-extendedInfo:failed unity_JoinMatch for appId=990652, privateAddress:, publicAddress:, serverId=Invalid]-address:,port:0,networkId:0x0000000000000000,nodeId:0x0000,usingRelay:False
    3. UnityEngine.Networking.Match.<ProcessMatchResponse>c__Iterator0`1:MoveNext()  
    When i'm trying to join a match with no password everything is fine.

    What am I missing?
    Thanks.