Put it all together - Entitlements Essentials - (Unreal Engine module)
Last updated on July 28, 2025
Connect the UI to the entitlement query
-
Open the
OwnedCountWidgetEntry_Starter
CPP file, find theRetrieveEntitlementWithForceRequest()
function, and replace the existing implementation with the code below. This updated code calls theGetOrQueryUserItemEntitlement()
function you implemented earlier and bindsShowOwnedCount()
as the on-complete delegate.void UOwnedCountWidgetEntry_Starter::RetrieveEntitlementWithForceRequest(const bool bForceRequest)
{
SetVisibility(ESlateVisibility::Collapsed);
W_Parent = GetFirstOccurenceOuter<UStoreItemListEntry>();
if (W_Parent)
{
// Get item.
const UStoreItemDataObject* ItemData = W_Parent->GetItemData();
if (!ItemData)
{
return;
}
EntitlementsSubsystem->GetOrQueryUserItemEntitlement(
GetOwningPlayer(),
ItemData->GetStoreItemId(),
FOnGetOrQueryUserItemEntitlementComplete::CreateUObject(this, &ThisClass::ShowOwnedCount),
bForceRequest);
}
} -
Open the
InventoryWidget_Starter
CPP file, find theNativeOnActivated()
function, and replace the existing implementation with the code below. This updated code calls theGetOrQueryUserEntitlements()
function you implemented earlier when the widget opens.void UInventoryWidget_Starter::NativeOnActivated()
{
Super::NativeOnActivated();
EntitlementsSubsystem = GetGameInstance()->GetSubsystem<UEntitlementsEssentialsSubsystem_Starter>();
ensure(EntitlementsSubsystem);
// bind
Tv_Content->OnItemClicked().AddUObject(this, &UInventoryWidget_Starter::OnClickListItem);
Btn_Back->OnClicked().AddUObject(this, &ThisClass::DeactivateWidget);
Btn_Equip->OnClicked().AddUObject(this, &ThisClass::OnClickEquip);
Btn_Unequip->OnClicked().AddUObject(this, &ThisClass::OnClickUnEquip);
// reset UI
Ws_Root->SetWidgetState(EAccelByteWarsWidgetSwitcherState::Loading);
EntitlementsSubsystem->GetOrQueryUserEntitlements(
GetOwningPlayer(),
FOnGetOrQueryUserEntitlementsComplete::CreateUObject(this, &ThisClass::ShowEntitlements));
SelectedItem = nullptr;
SwitchToDefaultState();
Btn_Equip->SetVisibility(ESlateVisibility::Collapsed);
}
Resources
- The files used in this tutorial section are available in the Byte Wars GitHub repository.