You can skip the find
bool UInventorySystemComponent::FindEmptySlot(int& Index)
{
int currentIndex = 0;
for (FInventorySlotStruct Content : InventoryContent)
{
if (Content.Quantity == 0)
{
Index = currentIndex;
return true;
}
currentIndex++;
}
Index = -1;
return false;
}