SaladLab / Unity3D.IncrementalCompiler

Unity3D Incremental C# Compiler using Roslyn
MIT License
355 stars 37 forks source link

an If directive destroyed the compiler, all C#6 features show up as errors #22

Open oxysoft opened 7 years ago

oxysoft commented 7 years ago

I added an #if directive and then my project stopped compiling from that point on. I get errors like these wherever C#6 features are used

Removing the directive didn't help either. By the look of it, the compiler isn't even getting loaded anymore because the compiler settings menu item isn't anywhere to be found under "Assets"

oxysoft commented 7 years ago

After experimenting, I believe I've came to somewhat understanding the problem.

  1. The if directive or something else must have nuked the incremental compiler
  2. Error began appearing as C#6 features were no longer supported
  3. The incremental compiler cannot be loaded while there are errors in the project (meaning that you cannot have a codebase using C#6 features already without the compiler, then add the compiler and have it work fine)

Please confirm if this is indeed the issue and how we can avoid this happening in the future. Fixing the issue altogether involved removing all the scripts out of the project, making sure it compiles, and adding them back in where the incremental compiler would now be loaded.

This however caused Unity to ruin all configuration on any script that was added to game objects as they were unknown for a period of time, so I had to reconfigure it all so that it was somewhat the same as before. (on the upside, I actually like the new image effect configurations better than before) It wasn't so bad since the project wasn't that advanced but it could be very destructive to games more advanced in development.