If I mistype a variable in an assignment a new variable is created. That is a vary nasty situation, as it is hard to find.
Can I make Unity accept only variables when declared with a leading var? If not, can I get warnings?
Thanks, Flo
If I mistype a variable in an assignment a new variable is created. That is a vary nasty situation, as it is hard to find.
Can I make Unity accept only variables when declared with a leading var? If not, can I get warnings?
Thanks, Flo
If your script is written in C# you will receive a compiler error when you make a mistake like that. So if you find yourself making this mistake often you might consider switching to C#.
No...Unity used to provide warnings about unused variables in JS in a past version, but doesn't anymore for some reason. (At least not for local variables.) Hopefully they will put this feature back sometime.