- Home /
Noob needs help : "expecting }, found " "
var myTimer : float = 5.0;
function Update(){
if (myTimer >=0) {
(myTimer (Time.deltaTime));
if(myTimer <=0){
Debug.Log ("GAME OVER");
}
}
What did I do wrong? :S
Comment
Best Answer
Answer by Mexallon · May 13, 2013 at 06:57 AM
Hey there. Just what it sounds like, your missing a "}". But i assume you are counting to zero so if the timer is not yet zero (the first case) you want to subtract the time since the last frame from the timer that would be like this:
var myTimer : float = 5.0;
function Update(){
if (myTimer >0) {
myTimer = myTimer - Time.deltaTime;
}
if(myTimer <=0){
Debug.Log ("GAME OVER");
}
}
Answer by SubatomicHero · May 13, 2013 at 06:56 AM
Youre missing a "{":
var myTimer : float = 5.0;
function Update(){
if (myTimer >=0) {
myTimer (Time.deltaTime));
} // this is what you were missing
if (myTimer >= 0) {
Debug.Log("GAME OVER");
}
}
Everytime you open a bracket, you must close it :D
Your answer
Follow this Question
Related Questions
Parenting after X time with collision, I dont get it! 1 Answer
How to compare the game time to a float? 1 Answer
Digital Clock: Time.time > 60 2 Answers
deltatime glitches 1 Answer
Fade in AudioLister over time #c 1 Answer