I have a "for" loop that should give the user an item. I have the inventory scripts set up already, everything in good order. However, I do not know how to add the item to the inventory when the player presses "E" and the mouse cursor is over the item (cursor locked in screen center and cross-hair set up).
for(var x = 0; x < loot.length; x++) {
Inventory.playerInventory.Add(loot[x]);
}
Can anyone help me? Do I use OnMouseEnter?
Thanks in advance!
↧