Pulling by ItemID in the code is actually inefficient at this point, when you can make a reference to the items directly. Your itemID will not match the itemID from the course, and for feeding the Inventory from Awake(), it’s unneeded when you can instead create a pre-load serializedField. ItemIDs make much more sense when it’s time to Save and Restore the items.
[SerializeField] InventoryItem[] preLoadedItems;
void Awake()
{
foreach(InventoryItem item in preLoadedItems)
{
AddToFirstEmptySlot(item);
}
}
Bear in mind that the version of the Inventory script you are using is not the final version in which we will be dealing with InventorySlots
struct InventorySlot
{
InventoryItem item;
int number;
}
instead of simply InventoryItems (because it might be handy to know how many are in the slot for stackables).