Hi
I was reading toons of posts regarding WaitForSeconds in c# and cant get it working.
“WaitForSeconds” just don`t run like not beeing in code.
Any clues ???
using UnityEngine;
using System.Collections;
using System;
public class MyCreator : MonoBehaviour {
public GameObject box;
public bool readynow = true;
int counter =0;
public int limit=100;
// Update is called once per frame
void Update () {
if(counter<=limit) {
StartCoroutine(MakeBox());
counter++;
}
}
IEnumerator MakeBox() {
readynow=false;
Instantiate(box, transform.position, transform.rotation);
yield return new WaitForSeconds(4.0f);
readynow=true;
}
}