I have a 2d game where there is an original enemy ninja.
I created spawning script to clone my original ninja. I then placed it on my main camera to make my ninja clone spawn within the main camera view. My original ninja also has a script that after a few seconds it will delete.
I realize that deleting my original ninja cause my clone ninjas not appear, but I want to delete any cloned objects so that I won't over run my project.
Is there a way were I can delete the spawn clone ninjas without touching the original ninja. Or hiding my original ninja in the inspector without hiding the spawn clones.
Here's my destroy ninja code:
private IEnumerator Killninja() {
yield return new WaitForSeconds (4f);
Destroy (gameObject);
}
void Update () {
StartCoroutine (Killninja ());
}