i try to make infinite object with clone as enemies. But when the real object has been destroyed, cloning has stop. I try this code to clone the object.
using UnityEngine;
using System.Collections;
public class Spawner : MonoBehaviour {
public GameObject enemy;
void Start(){
StartCoroutine (EnemySpawn ());
}
IEnumerator EnemySpawn(){
while(true)
{
Instantiate (enemy, transform.position, Quaternion.identity );
yield return new WaitForSeconds(3f);
}
}
}