Hi all,
Im trying to get a a GUI button when pressed to fade out and fade another GUI button in.
I have been able to get the first button to fade out but I am unsure how to fade the second one in, here is my code so far,
var showGUI:boolean = true;
var alpha:float;
var glasswater: Texture2D;
function Update(){
if(showGUI){
FadeIn();
} else {
FadeOut();
}
};
function FadeOut(){
alpha = Mathf.Lerp(alpha,0,Time.deltaTime*5);
};
function FadeIn(){
alpha = Mathf.Lerp(alpha,1,Time.deltaTime*5);
};
function OnGUI(){
GUI.color.a = alpha;
if(GUI.Button(Rect(Screen.width/2 - 77.625, Screen.height/2- 146.125, 155.25, 372.25), glasswater)){
showGUI=false;
};
};
Thanks
D