Im trying to write a timer for my spotlight to turn off but it says insert semicolon at lines 3,4 can anyone help me?
float timer;
int waitingTime;
void Update(){
timer += Time.deltaTime;
if(timer > waitingTime){
//Action
timer = 0;
}
}
Im trying to write a timer for my spotlight to turn off but it says insert semicolon at lines 3,4 can anyone help me?
float timer;
int waitingTime;
void Update(){
timer += Time.deltaTime;
if(timer > waitingTime){
//Action
timer = 0;
}
}
Is your script a Javascript file or C#? The code given makes it look like C# syntax, but if this is not just a snippet, you are missing a bunch of other context.
@LyanApps is likely right. I pasted your code into a class, and it compiles without errors: using UnityEngine; using System.Collections; public class foo : MonoBehaviour { float timer; int waitingTime; void Update(){ timer += Time.deltaTime; if(timer > waitingTime){ //Action timer = 0; } } }
– robertbu