OK, well I’m trying to show a bonus score when a player hits something with a missile, but this code below is not fading… it does work to show the score and then disappear after a few seconds though… any quick things I’m missing? I know it must be simple.
I’ve snipped this from elsewhere and modified for my purpose -
function OnGUI () {
if(showscore){
GUI.color = color;
GUI.Label(Rect(Screen.width / 2 - 100, Screen.height / 2, 600, 100), "BONUS +" + bonus,bonusstyle);
Fade();
}
}
function Fade(){
color = Color.black;
yield WaitForSeconds (2);
while (color.a > 0)
{
color.a -= Time.deltaTime;
yield;
}
showscore=false;
}