Cancel Matchmaking
Last updated on
The party leader can cancel matchmaking before a match is found. The players will also be notified that the matchmaking process is canceled. To implement this feature, refer to the function below.
- Unreal Engine
- Unity
FString GameMode = FString("2v2");
FRegistry::Lobby.Connect();
FRegistry::Lobby.SetCancelMatchmakingResponseDelegate(AccelByte::Api::Lobby::MatchmakingCancelResponse.CreateLambda([](const FAccelByteModelsMatchmakingResponse& Result)
{
if (Result.Code == "0")
{
// Do something if CancelMatchmakingResponseDelegate has been successful
}
else
{
// Do something if CancelMatchmakingResponseDelegate has an error
}
}));
FRegistry::Lobby.SendCancelMatchmaking(GameMode);
string gameMode = "2v2";
AccelBytePlugin.GetLobby().Connect();
AccelBytePlugin.GetLobby().CancelMatchmaking(gameMode, result =>
{
if (result.IsError)
{
// Do something if CancelMatchmaking has an error
Debug.Log($"Error CancelMatchmaking, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if CancelMatchmaking has been successful
}
});