Opticgamer
Member
Hello,
I'm trying to make a script that whenever a player enters a Collider trigger it adds a weapon to the players inventory. I am getting an error saying:
I was looking at the pickup script provided in the documentation:
Is there another way to add an item type into a players inventory? I'm using pun by the way too. Also is there a way to check if the player already has a specific item type in their inventory?
I'm trying to make a script that whenever a player enters a Collider trigger it adds a weapon to the players inventory. I am getting an error saying:
error CS1061: 'InventoryBase' does not contain a definition for 'PickupItemType' and no accessible extension method 'PickupItemType' accepting a first argument of type 'InventoryBase' could be found (are you missing a using directive or an assembly reference?)
I was looking at the pickup script provided in the documentation:
Code:
[Tooltip("The character that should pickup the item.")]
[SerializeField] protected GameObject m_Character;
[Tooltip("The ItemType that the character should pickup.")]
[SerializeField] protected ItemType m_ItemType;
[Tooltip("The number of ItemType that the character shouldpickup.")]
[SerializeField] protected int m_Count = 1;
public void Start() {
var inventory = m_Character.GetComponent<InventoryBase>();
if (inventory == null) {
return;
}
inventory.PickupItemType(m_ItemType, m_Count, -1, true,false);
}
Is there another way to add an item type into a players inventory? I'm using pun by the way too. Also is there a way to check if the player already has a specific item type in their inventory?