すべてを統合する - フレンドとプレイする - (Unreal Engine モジュール)
Last updated on October 23, 2024
Connect the UI to invite friend to game session
Open the
InviteToGameSessionWidget_Starter
CPP file and navigate toInviteToSession
function and replace it with the code below.void UInviteToGameSessionWidget_Starter::InviteToSession()
{
const UFriendData* FriendData = GetFriendDataFromParentWidget();
if (!FriendData)
{
return;
}
// disable button for 5 seconds to avoid spamming
Btn_Invite->SetIsEnabled(false);
GetGameInstance()->GetTimerManager().SetTimer(
InviteDelayTimerHandle,
FTimerDelegate::CreateWeakLambda(this, [this]()
{
Btn_Invite->SetIsEnabled(true);
}),
5.0f,
false,
5.0f);
Subsystem->SendGameSessionInvite(GetOwningPlayer(), FriendData->UserId);
}
Resources
- The files used in this tutorial section are available in the Unreal Byte Wars GitHub repository.