//Thats inside a function
float tempMinPaused;
if (tempMinPaused == float.IsNaN){
tempMinPaused += Time.deltaTime;
}
//Operator "==" cannot be applied of operands of type 'float' and 'method group'
Then assign it. give it a default value you want it to start at.
And no, outside fields can also throw the unassigned exception. usually happens with reference types and certain structs. but simple value types can do this as well
Edit:
He could be getting NAN due to a math result such as dividing by 0 or Tan(Pi/2)
I will get the duration of the last frame, every time the function is called.
If I couldn’t declare it, i will just equal it to 0 the first time the function is called, and the rest of times, when it were already declared to 0 sum the duration of every lastFrame.
It’s doable in browser-based JavaScript because JS just pukes stuff to the global scope:
x = 5; //now there's a global x that's 5, congratulations
“very useful” is an interesting way to put “fundamentally broken”. If you now write the same thing in a different script anywhere, the two scripts are now re-defining the same global variable.
Not sure if UnityScript works like that - I doubt it? That would mean that they’d introduced a global key-value store to UnityScript to match how broken JavaScript is.