I am trying to make a DOTA/ League of Legends/ Heroes of Newarth type of game. I am having trouble with waitForSeconds and Instantiate in C#. This is what I have so far.
public GameObject Minion;
public int MinionsPerWave;
void Update ()
{
Instantiate(Minion, new Vector3(-290, 1, -275), Quaternion.identity);
//MinionSpawn();
}
IEnumerator MinionSpawn()
{
for (int i = 0; i < MinionsPerWave; i++)
{
//GameObject newObject = (GameObject)Instantiate(Minion, new Vector3(-290, 1, -275), Quaternion.identity);
Instantiate(Minion, new Vector3(-290, 1, -275), Quaternion.identity);
yield return new WaitForSeconds(1);
}
}
I have some things commented out to show what I’ve tried. The way I have it is the only way Instantiate works.
My overall goal is to have an Instantiate of Minion come out every second until it reaches MinionsPerWave.