- Home /
UNET Matchmaker Destroy Match no callback
Hey folks, Im creating a lobby for an online game using the Unity matchmaking service. There is a toggle that starts or stops the online host with the functions StartServer() and StopServer(). The OnMatchCreate callback is invoked properly and ListMatches() also shows up the match. Now, when I want to stop the server and destroy the match, the console shows following internal log:
MatchMakingClient Destroy :https://mm.unet.unity3d.com/json/reply/DestroyMatchRequest UnityEngine.Networking.Match.NetworkMatch:DestroyMatch(NetworkID, ResponseDelegate`1)
However, the callback function OnDestroyMatch is never invoked!
Therefore I cannot properly remove a match from the lobby and I have to wait until the match is removed after a timeout. Am I missing something?
private CreateMatchResponse matchInfo;
public void StartServer()
{
networkManager.matchMaker.CreateMatch("Game", 2, true, "", OnMatchCreate);
}
public void OnMatchCreate(CreateMatchResponse matchInfo)
{
Debug.Log("OnMatchCreate. ID: " + matchInfo.networkId);
this.matchInfo = matchInfo;
}
public void StopServer()
{
networkManager.matchMaker.DestroyMatch(matchInfo.networkId, OnMatchDestroyed);
}
public void OnMatchDestroyed(BasicResponse response)
{
print("OnMatchDestroyed.");
}
+1. Would also like to know to remove matches to prevent host joining his own already destroyed matches.
Answer by Wumbo_Games · Jun 30, 2016 at 08:48 PM
From what I have found, it appears that the callback system here is more or less broken. According to this incredibly helpful article:
http://wontonst.blogspot.com/2015/07/making-custom-networkmanagerhud-in.html
it seems that the best work around is to manually override NetworkManager, and use the methods there. As unfortunate and inconvenient as this is, it would probably help if you haven't already designed your project to work from a non-extended NetworkManager as I did.
Good luck!
Your answer
Follow this Question
Related Questions
can i make a matchmaking without choose server 1 Answer
Detect active servers and join UNet 0 Answers
Making own server instead of using unity matchmaking and relay servers? 1 Answer
How to spawn a player in multiplayer on Android with Photon? 1 Answer
Is it possible to make a Multiplayer (1v1) game WITHOUT hosting servers? 3 Answers