Recursive Unity Coroutine

by user3797758   Last Updated November 15, 2017 18:13 PM

I have a co-routine which is heavily reliant on calling itself to get the task done. I have tested it and the code works fine, the problem is that the co-routine will return every time that it enters itself recursively.

IEnumerator test(arg1, arg2)
{
    // I want to pause here
    yield return null;

    // I don't want to pause on any of these
    yield return test(arg1, arg2); 
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
    yield return test(arg1, arg2);
}

In the example above I have a yield return at the top that is hit and pauses the co-routine, thats fine. Then there are the calls to itself below which also pause the co-routine. How do I avoid pausing the co-routine on the recurcive calls?



Related Questions



Lua tree linking to a previous element causes nil data

Updated October 14, 2017 22:13 PM

Tessellating/Subdividing a quad

Updated August 29, 2018 22:13 PM

Recursively get all combinations of tiles

Updated January 11, 2018 09:13 AM