In the following code, Sam uses a return instead of a yield return.
public IEnumerator FadeOut(float time)
{
return Fade(1, time);
}
public IEnumerator FadeIn(float time)
{
return Fade(0, time);
}
I understand that an IEnumerator must have at least one yield return statement. Is that correct?
Also, if we used yield return
instead of return
, how would that change the behavior of our fader?
I guess it makes sense to yield return Fade()
as it is in our best interest to wait for Fade() to finish.