private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { inventparent.AddItemToInvent(icon, itemprefab, Itemname, amount, ItemDescription, type); Debug.Log("Got " + Itemname); Destroy(gameObject); //Destroy self after use } }
public void Interact() { inventparent.AddItemToInvent(icon, itemprefab, Itemname, amount, ItemDescription, type); Debug.Log("Got " + Itemname); Destroy(gameObject); //Destroy self after use }