I want to make the GUItext Fade in and Fade out,but it seems there have some wrong code in “FadeIn” part,it just can play “FadeOut”.
Can anyone help X( Thanks a lot!
#pragma strict
var color : Color;
function Start(){
color = Color.white;
guiText.material.color.a = 0;
FadeIn();
}
function Update(){
FadeOut();
}
function FadeIn(){
while (guiText.material.color.a < 1){
guiText.material.color.a += 0.1 * Time.deltaTime * 0.05;
yield;
}
}
function FadeOut(){
while (guiText.material.color.a > 0){
guiText.material.color.a -= 0.1 * Time.deltaTime * 0.05;
yield;
}
}