Solution to double coin pickup

Hi all, I had the double coin pickup issue and also the issue where the sound was distorted when using Rick’s method. I used code to disable the collider and sprite renderer while the sound played which solved both problems at the same time. Enjoy!

 if(other.tag == "Player")
        {
            Destroy(gameObject, 1f);
            coinPickupSFX = GetComponent<AudioSource>();
            coinPickupSFX.Play();
            coinSprite = GetComponent<SpriteRenderer>();
            coinSprite.enabled = false;
            coinCollider = GetComponent<CircleCollider2D>();
            coinCollider.enabled = false;
}

So this was me being dumb and not a solution at all. Bool was still required to make sure there are no double pickups.