Probably pretty obvious question, but I’m learning Javascript by trying shit out (thus far, it works fine).
My variable ‘time’ remains 0. It’s probably because I say “public var time = 0” at the start of my program, but how else should I declare it?
public var time = 0;
function Update () {
time+= Time.deltaTime;
print(time);
}
function OnGUI(){
GUI.Box (new Rect(Screen.width-160, 10, 150, 40), "Time: " + time);
}
It’s public because I will need to access it from my Reset() function (in another class) later.