The inventory method HasSpaceFor takes in an inventory item. I cant see why we would need to pass in an item here since the method that its calling FindEmptySlot only returns the number of the slot that is available. Item is never used.
Item is certainly used. HasSpaceFor
doesn’t call FindEmptySlot
it calls FindSlot
which tries to find an existing stack for the item we pass in and only if it cannot find one does it call FindEmptySlot
to find a slot that is available.
ok thnx this is probably further along in the course. Right now findslot just returns findemptyslot.
Ok, I looked at the repo and the video wasn’t really showing what’s in FindSlot
The code in the sections prior to integration is incomplete, as Sam only put what was needed for the lessons in each section. In the Integration section, we’ll give you a pack with the complete Inventory code and sample UI, where methods like HasSpaceFor() are properly fleshed out.