- Home /
Re-hosting a Match in unity creates a bunch of random errors
Hi, I was searching the net for an answer to this question, but I could not find solution that I was hoping for. I am working on a competitive multiplayer game with 2 different maps and 3 different game modes. I matchmake, the game is hosted if no match is found, or joined if match is found. The first match works perfectly fine, however, when I leave the room, and I use this: networkManager.StopAllCoroutines();
networkManager.StopClient();
networkManager.StopMatchMaker();
if (NetworkServer.active) {
Debug.Log("Destroyed match");
networkManager.StopHost();
matchUp.DestroyMatch();
}
// Disconnect from the host and leave the match
else {
Debug.Log("Left match");
matchUp.LeaveMatch();
}
NetworkServer.Reset(); //also called when I host a new game, just in case
Anytime I tried to join/host after the first match, it threw random Missing Reference exceptions and the game would not play. NetworkManager is persistent. Please HELP me :), I would really appreciate it.
Hard to do without the error message. Add it to the question, then you might get guesses at what the cause is.
Answer by Zebadiah · Sep 12, 2018 at 03:00 AM
Match Up developer here.
The problem is probably the NetworkMatch component getting removed at some point. The solution is probably to add a StartMatchMaker() call somewhere before you start a new match.
It's hard to tell without a stack trace or line number for the error but that seems like the most likely culprit.
Hi, thanks for responding. I have traced the huge error log and found a couple of root errors causing every consequential one.
Transaction: Timed out waiting for response from matchmaking server. UnityEngine.Debug:LogError(Object) $$anonymous$$atchUp.Transaction:Timeout() (at Assets/$$anonymous$$atch Up/Internal/Transaction.cs:40) $$anonymous$$atchUp.c__Iterator3:$$anonymous$$oveNext() (at Assets/$$anonymous$$atch Up/$$anonymous$$atchmaker.cs:609) UnityEngine.SetupCoroutine:Invoke$$anonymous$$oveNext(IEnumerator, IntPtr)
and:
$$anonymous$$atch Up: Received a response for which there is no open transaction: r... UnityEngine.Debug:LogWarning(Object) $$anonymous$$atchUp.$$anonymous$$atchmaker:Update() (at Assets/$$anonymous$$atch Up/$$anonymous$$atchmaker.cs:180)
where it all starts to go wrong afterward.