Trying to create a simple chronometer:
var minutes : int = 0;
var seconds : float = 0.0;
function Update () {
seconds = seconds + Time.deltaTime;
if(seconds >= 60){
minutes++;
seconds = seconds - 60;
}
Debug.Log(minutes + " : " + seconds);
}
I always get an error:
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
Time.Update () (at Assets/Scripts/Time.js:6)
I also tried this tutorial and the code that was working fine in the video gave the same error for me again.
Plus puting the Time.deltaTime in Debug.Log only shows Null…
So I am stuck at this now ![]()
Please format your code properly.
– Eric5h5