Ready Consent
Last updated on
Ready Consent
After the matchmaking process is completed, every player in each party needs to confirm their readiness to start the game. To implement this feature, refer to the function below. You'll need a match Id to run the Ready Consent function. The match id will be received by the matchmaking notification after the start of matchmaking.
- Unreal Engine
- Unity
FString MatchId = FString("SomeMatchId");
FRegistry::Lobby.Connect();
FRegistry::Lobby.SetReadyConsentResponseDelegate(AccelByte::Api::Lobby::ReadyConsentResponse.CreateLambda([](const FAccelByteModelsReadyConsentRequest& Result)
{
if (Result.Code == "0")
{
// Do something if ReadyConsentResponseDelegate has been successful
}
else
{
// Do something if ReadyConsentResponseDelegate has an error
}
}));
FRegistry::Lobby.SendReadyConsentRequest(MatchId);
string matchId = "SomeMatchId";
AccelBytePlugin.GetLobby().Connect();
AccelBytePlugin.GetLobby().ConfirmReadyForMatch(matchId, result =>
{
if (result.IsError)
{
// Do something if ConfirmReadyForMatch has an error
Debug.Log($"Error ConfirmReadyForMatch, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if ConfirmReadyForMatch has been successful
}
});