Quantcast
Viewing all articles
Browse latest Browse all 34

Loop a function, once per second, X number of times

I need to call a function once per second for X number of times. How can I do this? I can't use an IEnumerator because "yield return new WaitForSeconds(5);" inside of a For Loop exits the For Loop, and it only runs one time. I can't use InvokeRepeating, because I need to loop X number of times. Been at this for an hour or 2, can't figure out any way to: **Loop a function, once per second, X number of times.** Just like this: (But this code only runs one time) for(int i=0; i < total; i++){ yield return new WaitForSeconds(1f); }

Viewing all articles
Browse latest Browse all 34

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>