I was just wondering whether this different implementation is somehow worse/better than the one shown in the video:
My implementation:
void UPaintingGrid::ClearPaintings()
{
if (!PaintingGrid) return;
TArray <UWidget*> WidgetList = PaintingGrid->GetAllChildren();
for (UWidget* Widget : WidgetList)
{
(Cast<USizeBox>(Widget))->ClearChildren();
}
}
Video imlementation:
void UPaintingGrid::ClearPaintings()
{
for (int32 i = 0; i < PaintingGrid->GetChildrenCount(); ++i)
{
USizeBox* CardContainer = Cast<USizeBox>(PaintingGrid->GetChildAt(i);
if(!CardContainer) continue;
CardContainer->ClearChildren();
}
}
Perhaps it is just a style choice, but I think it is worth showing as it works just as good.