- Home /
Fade in and out a GUIText pressing another GUItext?
In my scene, there are 3 GUIText, when I press the first button of them the other two will fade in, i made something like this this script its in the first button) :
var showtext:boolean = false;
var buttonSP = gameObject;
var buttonMP = gameObject;
function Start(){
buttonSP = GameObject.Find("ButtonSP");
buttonMP = GameObject.Find("ButtonMP");
Fade();
}
function OnMouseDown(){
showtext = true;
Fade();
}
function Fade(){
if (showtext == false){
while (guiText.color.a > 0){
buttonSP.guiText.material.color.a -= 10.1 * Time.deltaTime * 20;
buttonMP.guiText.material.color.a -= 10.1 * Time.deltaTime * 20;
yield;
}
}
if (showtext == true){
while (guiText.color.a > 1){
buttonSP.guiText.material.color.a -= 0.1 * Time.deltaTime * 20;
buttonMP.guiText.material.color.a -= 0.1 * Time.deltaTime * 20;
yield;
}
}
}
But nothing apears and I can´t find any other way to do this, ¿any idea?.
Comment
Your answer
Follow this Question
Related Questions
How do I repeat a part of my script? 2 Answers
Gui Pop-Up Notification for Picking up Items 1 Answer
Text size / position / fade in code 2 Answers
Display GUI when kill count reaches 5 1 Answer
Guitext fade in/out timing with trigger? 0 Answers