I need my object to spawn after it dies

I have to keep spawning enemies after the main enemy dies, here is the code `
using System.Collections;
using UnityEngine;
using UnityEngine.UI;

public class WaveSpawner : MonoBehaviour
{

public Transform enemyPrefab;
public Transform SpawnPoint;



public float TimeBetweenWaves = 6.5f;
private float countdown = 3f;

public Text waveCountdownText;

private int WaveIndex = 0;





void Update()
{
   
        if (countdown <= 0f)
        {
            StartCoroutine(SpawnWave());

            countdown = TimeBetweenWaves;
        }

        countdown -= Time.deltaTime;

        waveCountdownText.text = Mathf.Round(countdown).ToString();
    

        
    
   

}

IEnumerator SpawnWave()
{
    WaveIndex++;

    for (int i = 0; i < WaveIndex; i++)
    {
        SpawnEnemy();
        yield return new WaitForSeconds(0.7f);
    }

}

void SpawnEnemy()
{

Instantiate(enemyPrefab, SpawnPoint.position, SpawnPoint.rotation);

}

}
`

Hi there try to use this:

`
void SpawnEnemy() { 
GameObject enemy = Instantiate(enemyPrefab, SpawnPoint.position, SpawnPoint.rotation);
 }
`

in this way you can destroy and spawn any enemies you want, hope it help <3

@Bunnytoes

thanks @Ytsorf, please leave the done down below that would help me so much, thanks -Bunnytoes