Whenever I’m using Monodevelop-Unity to step through code in a for..in
loop (aka “foreach”), if I try to add the temporary variable to the watchlist, it always evaluates to null
, even when the value is clearly not null
(and the code executes to represent this).
For example:
for (var firingShip : GameObject in firingFleetArray) {
if (firingShip) {
firingShip.GetComponent(Ship).Fire();
}
}
If I add firingShip
to the Watch list, it always displays as null
. But at the same time if I add firingFleetArray
to the Watch list it will display its members correctly (none of which are null
). Additionally, I can Step Into the code and get to the Fire()
function, even though the code should skip over it if firingShip
were actually null
.
I’ve googled everywhere for something like this but can’t find anything. Is something messed-up about my installation, or am I missing some obvious setting?