[SOLVED] Is StopAllCoroutines stopsing itself?

Hello there!

I have this simple question. If you execute this: what will happen? Because i debbug it and it seems it continue executing, but it nere restarts, can someone explain me how it works a little better?

IEnumerator Deambular()
    {
        StopAllCoroutines();
        if (something) // THINGS A
        else 
        {
          // THINGS B
         yield return new WaitForSeconds(3));
         StartCoroutine(Deambular());
        }
    }

I wil never restart itself due that StopAllCoroutines, right=? Or What ?

Thanks in advance

Basically StopAllCoroutines will kill any instructions that are suspended by a yield instruction. In the simplest case:

IEnumerator Deambular ()
{
    StopAllCoroutines ();
    Debug.Log("BEFORE YIELD");
    yield return null;
    Debug.Log("AFTER YIELD");
}

will only print "BEFORE YIELD".

You should not call StapAllCoroutines() inside a coroutine. Do it before, it will stop all coroutines, theb if you start another one it will not be affected. If you want to stop a coroutine from inside, you can use yield break instead