Base Class IEnumerator Dilemma

Hi All.

I have a parent class and a child class. In the child class, I have an IEnumerator that calls a function in the base class like so:

 protected IEnumerator FunctionNameA()
    {
        for(int i = 0; i<10; i++){
             //do stuff.
        }
        return base.FunctionNameA ();
    }

This works well, It will do the stuff inside the IEnumerator and then start the function on the base.

The problem is when I wish to add a delay into the Ienumerator like so:

protected IEnumerator FunctionNameA()
{
    for(int i = 0; i<10; i++)
    {
        //do stuff
        yield return new WaitForSeconds(1f);  // but if I add this line.
    }
    return base.FunctionNameA();  // now this line no longer works and errors out. 
}

I can get rid of the error by removing the “return” infront of base.RestartLevel(); but then it will no longer call that function. Any idea whats going on here?

Thank you.

Shouldn’t you be using

 yield return StartCoroutine(base.FunctionName());

But you could simply call the other coroutine since there is no reason to keep it pending.