Commented out code still crashing game?

What the heck, I have never seen this before. I commented out code that was causing problems, saved and played the game. Again it gave me an error message on line 21 (photo included). I double clicked the error message to take me to the code. After that I even just commented out the Start() method (photo included) it still gave me a null reference?

I saved, quit and restarted the computer and same issue. What am I missing?


3605101--292855--Screen Shot 2018-08-21 at 3.17.13 PM.png

Any chance you had auto refresh disabled, so it didn’t recompile after the code was commented out?

You probably either haven’t saved your code, or haven’t updated changes to Unity Editor (Ctrl+R).
Put breakpoints before the commented code, and in very next sequence line. Check what is going on.

Auto Refresh is turned on in the preferences.

Just to add to the previous comments, a simple trick here is to add the line fred; to your script. Does it run? If so, the code is clearly not being compiled because fred should cause a compile time error.

( I always use “fred” because the keys sit right next to each other on the keyboard - I am that lazy :slight_smile: ).

It is resolved. I don’t know why it was causing a problem on this script. There was another networking script that I was working on and was also getting an error about initializers and constructors. I deleted that script for now and it works as expected. Thank you.