Why does the instantiate function generate two at once?

I’m writing an Asteroids game. Once an asteroid comes into contact with a projectile, it calls the public void of the asteroid generator “New” with the parameters “position” and “angle,” (the angle of the projectile so it can turn 90 degrees relative to it). All goes as expected except an oddity I want to stop: the instantiate function seems to create two instances at a time rather than one. I don’t like the excess due to performance concerns. Why does this occur and how can I stop it?

public class Asteroid : MonoBehaviour
{
public float speed;
Rigidbody2D rb;
AsteroidGenerator ag;
Vector3 direction;
void Start()
{
ag = FindObjectOfType();
rb = GetComponent();
transform.position = new Vector3(transform.position.x, transform.position.y, 0.5f);
}
void Update()
{
transform.Rotate(0,0,0.3f);
if (transform.position.x < -10) { transform.position += new Vector3(20, 0, 0); }
if (transform.position.x > 10) { transform.position -= new Vector3(20, 0, 0); }
if (transform.position.y < -6) { transform.position += new Vector3(0, 12, 0); }
if (transform.position.y > 6) { transform.position -= new Vector3(0, 12, 0); }
}
void OnTriggerEnter2D(Collider2D other)
{
if ((other.gameObject.tag == “Projectile”))
{
ag.New(transform.position, other.gameObject.transform.eulerAngles.z);
Destroy(gameObject);
}
}
}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AsteroidGenerator : MonoBehaviour
{
float newX;
float newY;
public GameObject asteroid;
GameObject newAsteroid;
void Start()
{
if (Random.Range(1, 2) == 1)
{
newX = Random.Range(-7, -4);
newY = Random.Range(-4, 4);
}
else
{
newX = Random.Range(4, 7);
newY = Random.Range(-4, 4);
}
newAsteroid = Instantiate(asteroid);
newAsteroid.transform.position = new Vector3(newX, newY, 0.5f);
newAsteroid.transform.rotation = Quaternion.Euler(0,0,Random.Range(-180,180));
}
public void New(Vector3 position, float angle)
{
newAsteroid = Instantiate(asteroid);
newAsteroid.transform.position = position;
newAsteroid.transform.rotation = Quaternion.Euler(0, 0, angle + 90);
newAsteroid = Instantiate(asteroid);
newAsteroid.transform.position = position;
newAsteroid.transform.rotation = Quaternion.Euler(0, 0, angle - 90);
}
}

You have two calls to `Instantiate` in one method. If you only wanted one you should only call it once.

Okay, I didn’t make myself clearer. Yes, two asteroids appear as I have intended it. However, each asteroid has a double within it resulting in FOUR asteroids meaning the Instantiate function is called twice for each individual use. When I only call it once, I get two asteroids. It doesn’t look like two because the extra clone is mimicking the other in perfection. Understand?

It will probably help to add some Debug.Log statements to see if some code is being triggered more often than you expect. For example, you could log the name of the object you hit in OnTriggerEnter2D. Maybe you actually have two projectiles hitting the asteroid in the same frame causing New() to be called twice.

I tried that, but I only got one message per generation.