Search Unity

OnInternetMatchCreate don´t return "sucess" (the match is working)

Discussion in 'Multiplayer' started by www_3dart_es, Apr 23, 2017.

  1. www_3dart_es

    www_3dart_es

    Joined:
    May 24, 2013
    Posts:
    219
    Hello, I want to know when the host started the Matchmaking, and I use:
    Code (CSharp):
    1. //this method is called when your request for creating a match is returned
    2.     private void OnInternetMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo)
    3.     {
    4.         if (success)
    5.         {
    6.             Debug.Log("Create match succeeded");
    7.  
    8.             MatchInfo hostInfo = matchInfo;
    9.             NetworkServer.Listen(hostInfo, 9000);
    10.  
    11.             NetworkManager.singleton.StartHost(hostInfo);
    12.         }
    13.         else
    14.         {
    15.             Debug.LogError("Create match failed");
    16.         }
    17.     }
    Code from here: https://docs.unity3d.com/550/Documentation/ScriptReference/Networking.Match.NetworkMatch.html

    The match is created and I can connect from a client to it but the "Debug.Log("Create match succeeded");" is never shown. I made a new proyect and put the basic to test it and continues equal.

    why it is not working?. I need to take something more in account?

    I am using Unity 5.5.2p4.

    Thanks in advance.
     
    Last edited: Apr 23, 2017
  2. www_3dart_es

    www_3dart_es

    Joined:
    May 24, 2013
    Posts:
    219
    I managed to achieve what I want using:

    if (NetworkServer.active == true) {
    ...
    }

    and

    if (manager.IsClientConnected ()) {
    ...
    }

    But I wonder why OnInternetMatchCreate don´t works. Any suggestions?
     
  3. JeremyUnity

    JeremyUnity

    Joined:
    Mar 4, 2014
    Posts:
    147
    Hi,
    If the callback is called and success is false the extendedInfo string will contain more info on why. Check that out or post back here and we can help you out.