It first of all turns Start into a coroutine itself. This is important because you need to delay the later bits of code within Start() until a later time, which is specifically the behavior that coroutines give you.
Then, it waits on the coroutine created for saySth(). Since coroutines inherit from YieldInstruction just like WaitForEndOfFrame and others, you can yield on a coroutine, waiting for it to finish.
What I do not know offhand is specifically when “output3” will be printed. It should definitely be after “output2”. But I don’t know if it will be immediately after and during the same frame, or if it will be delayed until the next frame. I’d hope for the former, but I’ve never tested this, and underlying implementation details have surprised me in the pass, so I’m being explicit about this ignorance.
So personally I have a class I call RadicalCoroutine that does all sorts of weird things, including chaining coroutines. But that’s going to be a bit overkill for you.
So instead, you’ll just have to do this with another coroutine.
have yet another function that is an IEnumerator to call func2?
Have SaySth raise an event at the end of itself, then on that event do ‘func2’.
There’s no direct built in way… like I said, I created my own RadicalCoroutine to have events and chaining and other stuff, but it may be super overkill for you (just integrating it into your project might be a little difficult). You could build your own as well that is simplified, and reusable, but nope… no built in way.
you use the Action parameter in your coroutine and call whatever the method you want to run after coroutine finished. Here is the 3-minute explanation.