Stop everything for 2 seconds in unity script

Hi,

I have 8 for loops. After executing each for loop, I want to pause the execution for 2 seconds. I know the cooroutine way but I have 8 for loops and it wont be a good idea to write 8 cooroutines. Is there an easier way to just pause the execution?

Why would you have to write 8 coroutines for the for loops, do it all in 1 coroutine.

They’ll be done sequentially no matter what since they’re all operated on the same thread.

Exactly as @lordofduct said:

IEnumerator MyLoops() {
  WaitForSeconds wtf = new WaitForSeconds(2);
  for( ; ) { }
  yield return wfs;
  for(;;) { }
  yield return wfs;
  // blah... etc!
  }

:slight_smile: Just thought I’d write that out for fun

Thanks you - Can I do pause within the for loop?

IEnumerator MyLoops() {


WaitForSeconds wtf = new WaitForSeconds(2);


for( ; ) {
//do something then
yield return wfs;
}




for(;;) {
//do something then
yield return wfs;
}




  }

I believe so… try it :slight_smile: