void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.name == "player" && !activated) { activated = true; // added this to prevent being able to get the power up twice while the sound is playing. Debug.Log("We have picked up a " + Enum.GetName(typeof(WeaponTypes), myPower) + " powerup!"); if (myPower == 0) // pistol { Debug.Log("Player has a pistol "); player.setSubWeapon(myPower); Debug.Log("Player has a sub weapon."); } soundEffect.PlayOneShot(aClip); GetComponent <SpriteRenderer>().enabled = false; // hide the object in the scene so it looks destroyed Destroy(gameObject, aClip.length); // destroy when sound is done playing } }