I'm sorry if this has been posted before. I've searched for hours and haven't been able to find it. I'll try to be as direct as possible.
I have a GUIText that looks perfect, it appears, it floats up and it disapears. The only problem is that it spawns when the game begins. I need this GUIText to stay inactive until a spicific game object (cube) is destroyed (collected by the character).
This is the scrip for the GUIText, now I just need help with the next step.
#pragma strict
public var color: Color = Color(0.8,0.8,0,1.0);
public var scroll: float = 0.05;
public var duration: float = 1.5;
public var alpha: float;
function Start(){
guiText.material.color = color;
alpha = 1;
}
function Update(){
if (alpha>0){
transform.position.y += scroll*Time.deltaTime;
alpha -= Time.deltaTime/duration;
guiText.material.color.a = alpha;
} else {
Destroy(gameObject);
}
}
If anybody can give me a hand with this, it'll be of great help.
Thank you.
↧