(サンプルコード)
using UnityEngine;
// ★追加
using System.Collections;
public class AutoGene4 : MonoBehaviour
{
public GameObject ballPrefab;
void Start()
{
StartCoroutine(BallGene());
}
private IEnumerator BallGene()
{
yield return new WaitForSeconds(1.0f);
while(true)
{
Instantiate(ballPrefab, transform.position, Quaternion.identity);
yield return new WaitForSeconds(1.0f);
}
}
}
(実行結果)