void OnTriggerEnter(Collider other) { if (other.tag == "goldCoin") { Physics.IgnoreCollision(other.GetComponent <Collider>(), GetComponent <Collider>(), false); } if (other.gameObject.CompareTag("Enemy") || other.gameObject.CompareTag("Boundary") || other.gameObject.CompareTag("BulletActivator") || other.gameObject.CompareTag("ShieldActivator") || other.gameObject.CompareTag("CleanerActivator")) { return; } Instantiate(coinCollected, transform.position, transform.rotation); if (other.tag == "Player") { Instantiate(coinCollected, other.transform.position, other.transform.rotation); if (PlayerPrefs.GetInt("OtherMusic") == 1) { AudioSource audioSource = GetComponent <AudioSource>(); audioSource.Play(); } Destroy(this.gameObject); _coinController.AddCoin(coinValue); } }