Question by
chris1988 · May 03, 2016 at 06:11 AM ·
guitextscene-loadingongui
How can I fade out a black screen with a white text on it? I tried some coding but nothing works. Goal: I want to fade out a scene with a black screen and a white text on it. My actual fader works but without a text...
void OnGUI () {
if (!starter) {
return;
}
GUI.color = new Color (GUI.color.r, GUI.color.g, GUI.color.b, alpha);
Texture2D pic;
pic = new Texture2D (1, 1);
pic.SetPixel (0, 0, fadeCol);
pic.Apply ();
GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), pic);
if (fadeIn) {
alpha = Mathf.Lerp (alpha, -0.1f, fadeTime * Time.deltaTime);
} else {
alpha = Mathf.Lerp (alpha, 1.1f, fadeTime * 0.4f);
}
if(alpha >= 1 && !fadeIn){
lnl.loadSceneAfterDialogue ();
} else if(alpha < 1 && fadeIn){
Destroy (gameObject);
}
}
Comment