Does anyone know why these widgets wont display when I add them to the scroll box? the UE_LOGs show It making it through all the logic, not sure what I am doing wrong.
// Add Child UInventoryItemWidget to Scroll box based on the number of items in the lootable actor.
void ULootableInventoryWidget::SetupScrollBox()
{
if (ItemScrollBox)
{
if (ACharacterBase* Player = Cast<ACharacterBase>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0)))
{
ALootable* ActorBeingLooted = Player->GetActorBeingLooted();
if (ActorBeingLooted)
{
for (int i = 0; i < ActorBeingLooted->AllItemData.Num(); i++)
{
UE_LOG(LogTemp, Warning, TEXT("Loop: %i"), i);
UInventoryItemWidget* Item = CreateWidget<UInventoryItemWidget>(this->GetOwningPlayer() ,InventoryItemWidgetClass);
Item->InitItem(ActorBeingLooted, i);
ItemScrollBox->AddChild(Item);
}
}
}
}
}
// Pass in the index of the created widget from ULootableInventoryWidget::SetupScrollBox() to Set properties.
void UInventoryItemWidget::InitItem(ALootable* Lootable, int Index)
{
Initialize();
SetupThumbnail(Lootable, Index);
SetupDisplayName(Lootable, Index);
SetupDescription(Lootable, Index);
UE_LOG(LogTemp, Warning, TEXT("Item init"));
}