private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Item") { var item = collision.GetComponent <ItemPickUp>().pickedUpItem.itemType; switch (item) { case ItemPickUp.ItemType.Potion: _playerCombatScript.AddHealth(); break; case ItemPickUp.ItemType.Coin: Debug.Log("Coin picked up"); break; default: break; } Destroy(collision.gameObject); } }