A simple question about yield

In unity doc , there’s an example:

IEnumerator WaitAndPrint() {
    yield return new WaitForSeconds(5);
    print("WaitAndPrint " + Time.time);
IEnumerator Example() {
    print("Starting " + Time.time);
    yield return WaitAndPrint();
    print("Done " + Time.time);

my question is:
what does " yield return WaitAndPrint();"mean ?

when I test the code with “StartCoroutine(Example())” ,
the line " yield return WaitAndPrint();" did nothing.

I was confused…

I am guessing you are referring to this page.

Notice that the example defines a WaitAndPrint function.
It is just there so you can see how you can define your own coroutines.

The WaitForSeconds is a built in coroutine.

Now, if you are confused about yield in general, you are not alone and don’t worry. It is easy once you get the hang of it.

See this doc page for a good introduction to yield in Unity.

Lastly, when you say “nothing happened” I am guessing you did not check the console window. You should see things printed there after a delay, that is created by all the WaitForSeconds calls.