IEnumerator SpawnLoop()
{
while (true)
{
Instantiate(
prefab,
transform.position,
transform.rotation
);
yield return new WaitForSeconds(
interval
);
}
}
Start:
StartCoroutine(SpawnLoop());