- Home /
Fade in/out continously
Hello!
I make a scene that it's seperated in 4 parts. How can I make the first part to start with a fading from black, and right before second part to fade out to a black sreen and then again to fade in?
Sorry for my english!
This is the script that I use, but it only makes the screen to fade in from black on start.
     #pragma strict
      
     // FadeInOut
      
     var fadeTexture : Texture2D;
     var fadeSpeed = 0.2;
     var drawDepth = -1000;
      
     private var alpha = 1.0;
     private var fadeDir = -1;
      
     function OnGUI(){
      
     alpha += fadeDir * fadeSpeed * Time.deltaTime;
     alpha = Mathf.Clamp01(alpha);
      
     GUI.color.a = alpha;
      
     GUI.depth = drawDepth;
      
     GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), fadeTexture);
     }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by robertbu · Apr 26, 2013 at 01:41 PM
See this answer for fading in/out continuously:
http://answers.unity3d.com/questions/443646/continue-fade-in-and-out.html
Your answer
 
 
             Follow this Question
Related Questions
Help with destroying guiRect? 0 Answers
Fill rectangle from bottom to top 1 Answer
GUI changes when game runs full screen 2 Answers
Strange shader behaviour on UI component 0 Answers
Can't destroy an ui element 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                