- Home /
How Can I Make Text That Fades In Then After A Delay The Next Text Fades In And Old Text Fades Out Etc.
I am making a fun little parody game and I want a really dramatic intro to the game. I have all the text made and was experimenting with activating and de-activating the text but couldn't figure out a timer that doesn't need any user input as I have 0 experience with timers. All I need is the basic code that can load text then unload it and load a different text.
               Comment
              
 
               
              Answer by Bren0831 · Mar 26, 2017 at 05:21 PM
I've figured out the fade out script
 public float fadeTime=1.0f;
 float startTime=0;
 
 // Use this for initialization
 void Start () {
     startTime=Time.time;
 }
 
 // Update is called once per frame
 void Update () {
     //Make the text move upwards
     transform.Translate(0,Time.deltaTime*1.0f,0);
     
     //Compute and set the alpha value
     float newAlpha=1.0f-(Time.time-startTime)/fadeTime;
     GetComponent<TextMesh>().color=new Color(1,1,1,newAlpha);
     
     //If alpha has decreased to zero, destroy this game object
     if (newAlpha<=0)
     {
         Destroy(gameObject);
     }
 }
}
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                