void OnTriggerEnter(Collider collider) { if (collider.tag == "Fireball") { // If the iceball collides with the hazard, spawn fireworks and increase score GameObject destroyedFireworks; destroyedFireworks = (GameObject)Instantiate(Resources.Load <GameObject>("Prefabs/Fireworks")); destroyedFireworks.transform.position = this.transform.position; spawner.IncreaseHitCount(); niceShot.Stop(); niceShot.enableEmission = true; niceShot.Play(); increase.Stop(); increase.enableEmission = true; increase.Play(); GameObject.Find("Cart").GetComponent <GameStats>().AddScore(150); GameObject.Destroy(collider.gameObject); GameObject.Destroy(this.gameObject); } }