Start the Matchmaking Process
Last updated on
The matchmaking can be started after the party leader invites another player to the party. The number of party members should match the configuration used when creating the matchmaking channel.
- Unreal Engine
- Unity
FString GameMode = FString("2v2");
FRegistry::Lobby.Connect();
FRegistry::Lobby.SetStartMatchmakingResponseDelegate(AccelByte::Api::Lobby::MatchmakingStartResponse.CreateLambda([](const FAccelByteModelsMatchmakingResponse& Result)
{
if (Result.Code == "0")
{
// Do something if StartMatchmakingResponseDelegate has been successful
}
else
{
// Do something if StartMatchmakingResponseDelegate has an error
}
}));
FRegistry::Lobby.SendStartMatchmaking(GameMode);
string gameMode = "2v2";
AccelBytePlugin.GetLobby().Connect();
AccelBytePlugin.GetLobby().StartMatchmaking(gameMode, result =>
{
if (result.IsError)
{
// Do something if StartMatchmaking has an error
Debug.Log($"Error StartMatchmaking, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if StartMatchmaking has been successful
}
});