Does coroutines are affected by Time.timeScale?

When I create an IEnumerator like this one:

IEnumerator Example ()
{  
    yield return new WaitForSeconds(20);
    //do something  
}

Let’s say that in another script I set Time.timeScale = 0 for some time. When I do this, the coroutine continue running to complete the 20 seconds or it pauses while timeScale is equals to 0?

Setting timeScale to 0 doesn’t stop coroutines, but stops WaitForSeconds. Coroutines continue executing each frame, but WaitForSeconds apparently uses the current Time.deltaTime, which becomes zero when timeScale = 0.

The simple test below shows this:

This is not C# but JS-like, now obsolete, Unity Script
function TestCoroutine(){
  for (var n=0; n < 5; n++){ // count 5 frames...
    print("frame "+n); 
    yield;
  }
  print("start delay 5 s");
  yield WaitForSeconds(5); 
  print("delay ended");
}
  
var pause = false;
  
function Update () {
  if (Input.GetKeyDown("escape")){
    pause = !pause;
    if (pause){
      Time.timeScale = 0;
      TestCoroutine();
    } else {
      Time.timeScale = 1;
    }
  }
}

When Escape is pressed, timeScale is set to 0 and TestCoroutine is started - the 5 frames are counted and WaitForSeconds(5) is started, but the 5 seconds wait time lasts forever until you press Escape again to return timeScale to 1.0.

Yes, it affects and it’s effect is normal when you keep that game objects which contains coroutine ON, While it is on every thing works fine.
If you TURN OFF the game object then every thing going to be mess.

You can use WaitForSecondsRealtime, it is the same that WaitForSeconds but it uses unscaled time.