I’ve tried using “function Update ()” but that updates every frame until the parameter changes from the if statement. I’m trying to make the lives increase by 1 when the score gets to a certain amount.
static var score: int;
static var lives: int;
function Start () {
score = 0;
lives = 3;
}
function OnGUI () {
GUI.Box (Rect (10,10,90,30), "Score: "+score);
GUI.Box (Rect (Screen.width - 100,10,90,30), "Lives: "+lives);
}
function Update () {
if (score == 20)
{
lives++;
}
}
I’ve looked up multiple ways to try and do this, but I’m a complete noob at javascript. I’ve heard to use coroutines, bool, and other things, but I don’t even know where to start with those. I even read about using invoke, awake, and the like, but I need it to change when the score reaches a certain amount, not during a timeframe. Thank you in advance, and any links/tuts would be greatly appreciated as this is my first week scripting.