Why does this work:
var _mode : int;
_mode = manager.gameMode;
if (_mode == mode.editSetup) {
//do some stuff
}
But not this:
if (manager.gameMode == mode.editSetup) {
//do some stuff
}
The compiler insists that manager.gameMode is an Object, even though it is declared this way (in another script):
var gameMode : int = 0;
mode is an enum, and the compiler is clearly treating it as int in this case (it complains that I’m trying to compare an Object to an int). The manager script has other vars in it that I reference without any problem. Why would the compiler think that this particular var reference is an object and not an int?