I'm working on a game where you fire ammo at enemy aircraft that are passing overhead. When the ammo collides with an aircraft, a particle system prefab is instantiated. This all works fine, except when the aircraft transforms to the left half of the display, the explosion doesn't happen. It works fine on the right half of the screen. Code is below: This was from an online tutorial which I modified to add the explosions. The aircraft gets destroyed on collision, but the explosions only happen on the right half of the display. ammoExplosion is a public gameobject that is defined in the class and assigned in the inspector. Any advice is appreciated.
void OnTriggerEnter2D(Collider2D collider){
if(collider.gameObject.tag == "Ammo"){
GameObject e = Instantiate (ammoExplosion) as GameObject;
e.transform.position = transform.position;
e.renderer.sortingLayerName = "Foreground";
e.renderer.sortingOrder = 13;
Destroy (transform.gameObject); // Destroy fighter.
Destroy (collider.gameObject); // Destroy ammo.
Destroy (e,0.7f);
}
}