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.");
}