How to dupe an object only once in unity?

Hey, I am new to Unity and I tried to create an asteroid script which would work like this:

  1. It will find the target object(where the asteroid will hit)

  2. It will dupe itself

  3. It will look at the target

  4. it will move towards it

  5. It will play a particle(for now)
    But there is a problem in duping. It dupes itself unlimited times until Unity crashes. How can I dupe only once and are there ways to improve this script? Also there is another problem, the asteroid just goes inside of the target(which is a cube) and doesn’t play the particle.
    Code:

    public Transform asteroid;
    public Transform target;
    public float speed;
    public ParticleSystem particle;
    // Start is called before the first frame update
    void Start()
    {
        
    }
    
    // Update is called once per frame
    void Update()
    {
        //Transform dupe = Instantiate(asteroid);
        //dupe.position = asteroid.position;
        asteroid.LookAt(target);
        asteroid.position = Vector3.MoveTowards(transform.position, target.transform.position, .03f);
    }
     void OnCollisionEnter(Collision other) {
        if (other.collider.tag == "target") {
            particle.Play();
        }
        else if (other.collider.tag == "Ground") {
            particle.Play();
        }
    }
    

You need to put instantiate command inside OnCollisionEnter.

You have also to check both your collisions that they are not set as trigger, by the Is Trigger property that collision component have.

Also change instantiate command like this:

Instantiate(asteroid, asteroid.position, asteroid.rotation);

Remove also transform property between target and position at MoveTowards method, because transform field does not have transform property. So that line looks like this:

asteroid.position = Vector3.MoveTowards(transform.position, target.position, .03f);