I’m making an asteroids clone. When I fire a beam from my ship, it hits the asteroids, and both the asteroid and the beam are destroyed. In their place, however, an explosion particle system prefab is instantiated. Everything works perfectly, except for the fact that two prefabs appear with each destroyed asteroid. Despite being able to play the newest, most demanding games on high or sometimes ultra settings at 60 fps, the two explosions slow my system down like crazy, which doesn’t make any sense to me.
Mind you, this is a 3D game. It all takes place in a 2d plane, but I’m using 3D assets, like the ship and the asteroids.
I’ve tried placing a single explosion in the scene and nothing slows down. Here is the relevant part of the Asteroid script.
public Transform boomObject; //Assign prefab in inspector
void OnCollisionEnter (Collision other) {
if (other.gameObject.name == "Beam(Clone)") { //check if collision is with my beam
Destroy (gameObject); //destroys asteroid
Destroy (other.gameObject); //destroys beam
Instantiate (boomObject, transform.position, Quaternion.identity); //makes 2 explosions?
}
}