IF ELSE PROBLEM WTF

Please guys tell me I need to sleep or smth, please… Dropbox - Error - Simplify your life (video example). How the “”“”“”“”“”“” !!! is this possible. As far as I see it enters the if and then the else if… WTF???

UPDATE1: more detailed video - Dropbox - Error - Simplify your life

UPDATE2: Dropbox - Error - Simplify your life . What the hek is this, seriously?

UPDATE3: I just sent the project to a fr to execute it, same story there. Absolutely the same.

You’re expecting prevSprite to be not null, which never happens. Debug.logs can verify your logic. Try replacing the “else if” line with “else”.

Edit:
If you’re confused about the line highlighting while stepping, that’s because it’s wrong. Stepping through a Unity script isn’t the same as a normal program. I presume Unity has to include extra code for profiling or whatnot. I really don’t know, but either way, step debugging and breakpoints aren’t needed. Debug.Log is the Unity way of debugging and is much more reliable when conveying information.

Are you using UnityVS? That’s not needed either… But if you have to use it, at least be aware of it’s current issues: http://unityvs.com/documentation/issues/

Stepping can be… buggy. Line of execution can be different than what is actually reported. Use an alternative method of debugging.