void OnTriggerEnter2D(Collider2D c) { if (!dying && c.gameObject.GetComponent <PlayerManager>() != null) { dying = true; s.ReachStar(levelId, starId); GetComponent <SpriteRenderer>().enabled = false; if (notPicked) { GameObject.Find("Main Camera").GetComponent <AudioSource>().PlayOneShot(getStarNoise); deathBubbles.Play(); } else { GameObject.Find("Main Camera").GetComponent <AudioSource>().PlayOneShot(gottenStarNoise); } Destroy(gameObject, 2f); // same as the bubble particle system lifetime } }