corotuine looping hang the editor.

hi guy i need some help urgent,
when i am lerp a color using Color.Lerp(c1,c2,t);
in coroutine like

IEnumerator FadeOut() {
    while(true) {
	if(fader.color.a>0) {
	   Color clr = Color.Lerp(fader.color, fadeOutColor, Time.deltaTime * 2f);
	   fader.color = clr;
        }
	if(fader.color.a <=0.02) {
	   isStart = false;
	}
   }
}

Unity editor hang :frowning: after click on play button :frowning:

  1. You need

    yield return null;

or any other yield inside while loop.

  1. Your while loop never ends. You either have to change true to another condition (e.g. while(isStart)) or when you want to end coroutine, execute yield break.

  2. Your lerping code will not work, because deltaTime is similar each update. Please look at the answer to this question for working code.