Unity compilation error: Expression expected after yield return

Today I’m trying to use coroutine to do the animation for Renderer’s alpha value (fade effect), it’s a lot simpler than modifying the alpha value in Update method.

Using the code from Unity Coroutine documentation will cause following error message:

Expression expected after yield return

Modifying yield return to yield return null will solve this problem. So the correct code should be like:

  • Carlos Alberto Carvajal

    Thanks!! this help me 🙂