Yet another thread about Guitexture Alpha fading in C#

So, im trying to (upon buttonpush) show a crosshair Guitexture, and the upon button release, the alpha of that texture should fade out. However this doesnt happen, and Im still kind of new with C#(Ive done this before in JS, but C# is tricky with this, it seems)

I cant make sense of the other posts on this subject, for my particular case. Anyways, here is the code as it looks now:

Reticle is my GuiTexture

if(Input.GetKey(KeyCode.F))
	{
			reticle.color = new Color(0.5f,0.5f,0.5f,0.2f);
}

if (!Input.GetKey(KeyCode.F))
	{
			StartCoroutine("FadeAlpha");

}

IEnumerator FadeAlpha(){
	reticle.color =new Color(0.5f,0.5f,0.5f,( Mathf.Lerp(0.2f,0.0f,0.6f)));
		yield return 0;
	}

This results in the alpha jumping to a lower value (20, in the inspector) and so the GuiTexture is still slightly visible. Also, it does not Lerp at all, which is probably something about Coroutines im doing wrong. Sorry to post another subject on this…

if you want to have progressiv fading, you dont use “yield return 0” but yield return new WaitForSeconds(timeStepValue)

I tried that already, but that changes nothing. The alpha still just jumps to a lower value instantly. I used WaitForSeconds(0.6f); as that is my Lerp time.

There’s no loop in your coroutine. Also - if your Input code is in Update then you’re kicking off a new coroutine every time your conditional evaluates to true. Probably not what you want.