Hello there
I’m trying to make a script to fade the screen to black when the scene ends, I’m trying to use Color.Lerp (as the tutorial Stealth says it has to be done) This is my code:
public void EndScene(){
guiTexture.enabled = true;
guiTexture.color = Color.Lerp (guiTexture.color,Color.black,fadeSpeed*Time.deltaTime);
Debug.Log(guiTexture.color.a);
if (guiTexture.color.a >= 0.95f) {
guiTexture.color=Color.black;
Application.LoadLevel(0);
}
}
I call the EndScene Function from the Update function of another Script, however I have debugged and what is happening is that the code never enter in the IF statement, I have printed guiTexture.color.a and it only gets random numbers between 0.001 and 0.060, or so, the point is it never reaches 0.95 so it never enters in the IF block. So I’m wondering how does Color.Lerp works? Am I missing another parameter or something? Why does it never reach the value I need?
Thanks for reading!