I want the scene to fade in from black to the actual scene. I have this code down here:
using UnityEngine;
using System.Collections;
public class FadeScript : MonoBehaviour
{
public static Texture2D Fade;
public bool fadingOut = false;
public float alphaFadeValue = 1;
public float fadeSpeed = 2;
public Texture2D blackscreen;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void OnGUI ()
{
alphaFadeValue -= Mathf.Clamp01(Time.deltaTime / 5);
GUI.color = new Color(0, 0, 0, alphaFadeValue);
GUI.DrawTexture( new Rect(0, 0, Screen.width, Screen.height ), blackscreen);
}
}
blackscreen is a completely black image by the way.
Anyway, the code doesn’t work the screen starts out white (not black) and after a second it immediately turns to the scene. What’s wrong here? Thank you!