yield return

The yield return node is used in coroutines to convert the yield instruction to an IEnumerator, which controls the behaviour of the coroutine.


Using example

In this example we will use the yield return node in the Coroutine function to convert the WaitForSeconds instruction into an IEnumerator and return it:

Then we can start our coroutine by using the StartCoroutine method (which was inherited from the Monobehaviour class):

Render time: 0.02 seconds
137,031 unique visits