Weird C# boolean behavior

I also have posted this under ‘Scripting’ but since this is somewhat of a bug, I am also posting it here. Here is the link of the thread in Scripting : http://forum.unity3d.com/threads/80784-Weird-C-boolean-behavior?p=516781#post516781

Hi guys,

I noticed that for some unknown reason, C# booleans in MonoDevelop/Unity become unreliable in some MonoBehaviours.

I noticed that even though I already set a certain variable explicitly as ‘false’, it still goes through in an ‘if’ statement. Attached is a screenshot of a test that I did. I stepped into the code and as you can see at the Watches below, the variable testX is currently set to ‘false’, but as you can also see, the program went inside of the ‘if’ statement.

Is anybody else experiencing this problem? Any workarounds?

516786--18357--$WeirdBooleanBehavior.png

It’s not a bug as I already answered, and you don’t need to cross-post; it just clutters up the forums when people do that.

–Eric