Search Unity

Network Manager StartClient freezes about half the time?

Discussion in 'Multiplayer' started by RuFiOHHHHH, Sep 8, 2017.

  1. RuFiOHHHHH

    RuFiOHHHHH

    Joined:
    Feb 8, 2014
    Posts:
    5
    I am making my first game using Unity's Multiplayer feature. Half of the time this experience has been great in testing - everything works perfectly. About half the time though as soon as the client joins the match it doesn't actually join the game - they don't appear in the host's version and objects that have a network identity are never activated in their version. I have no idea why it happens some time and not others. This occurs both on PC builds and on Android builds or when playing across both.

    This is the function that I think is the last place my code gets to and the one before it if that is any help -

    private void OnInternetMatchList(bool success, string extendedInfo, List<MatchInfoSnapshot> matches){
    if (success) {
    if (matches.Count != 0) {
    mgr.matchMaker.JoinMatch (matches [0].networkId, "", "", "", 0, 0, OnJoinInternetMatch);
    } else {
    //If no matches, make a match
    mgr.matchMaker.CreateMatch ("match", 2, true, "", "", "", 0, 0, OnInternetMatchCreate);
    }

    } else {
    Debug.Log ("Match list error");
    }
    }

    private void OnJoinInternetMatch(bool success, string extendedInfo, MatchInfo matchInfo){
    if (success) {
    Debug.Log ("Can join match");
    hostInfo = matchInfo;
    mgr.StartClient (hostInfo);
    } else {
    Debug.Log ("Join match error");
    }
    }

    If anyone has a tip I would greatly appreciate it, I can't find anyone with similar issues on the forum.

    Thanks!
     
  2. RuFiOHHHHH

    RuFiOHHHHH

    Joined:
    Feb 8, 2014
    Posts:
    5
    Still looking for help with this. Right now it only seems to happen about one out of every 5 or 10 times I run but having my game break 20% of the time makes it unplayable. Here's what it looks like when it is broken - no error messages. The host doesn't receive error messages either.
     

    Attached Files: