void OnTriggerEnter2D(Collider2D bam) { if (bam.CompareTag("ItemPickup") && bam.GetComponent <Renderer>().enabled) { ItemPickup pickup = bam.GetComponent <ItemPickup>(); if (pickup.item.CompareTag("Health")) { myHealth.Heal(6); } if (pickup.item.CompareTag("Weapon")) { myWeapon.EquipWeapon(pickup.item); pickup.TakeItem(); } pickup.Disable(); } }