I have no idea why this is happening but for some reason, after changing the alpha value to zero of the text material colour during gameplay, the alpha value does not revert back after I click the stop button. The alpha value remains 0. Here is the code i am doing:
IEnumerator Fade(){
for (float alpha = 1; alpha > 0; alpha -= (Time.deltaTime * fadeSpeed)) {
Color color = gameObject.GetComponent<Text>().material.color;
color.a = alpha;
gameObject.GetComponent<Text>().material.color = color;
yield return null;
}
}
Any suggestions on why this is happening?