unity error building player because scripts had compiler errors

hello i been using unity pro for sometime now but i have never came across a error like this. because of this error i’m unable to build my game and finish it :frowning: please help from Ben

it Seems that you are using package from asset store or any other place it happens because external packages contains demo scene you just need to delete all the script that are using UnityEditor just click on error message and unity will redirect you to the script look at the top of the script if there is statement like “using UnityEditor” delete that script and error will gone if it is not gone look there is another any script that contains “using UnityEditor” delete that.

What this is telling you is that you can’t use editor code in your builds. Which, when you think about it, makes perfect sense. “UnityEditor” is the namespace for all the code that is executed in the Editor. It isn’t part of the engine (“UnityEngine”).

Remove code from your game that uses components that are only available in the Editor. This could be file dialogs, for example.

Don’t know it’s already mentioned somewhere, but after looking through 100 revisions to find the Editor code responsible for “Error building Player because scripts had compiler errors” again I had to do something to remember the following:

  • open unity.csproj with a text editor (project file is locked inside VS)
  • delete all occurrences of UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;
  • reload solution, compile and see compile errors with file/line information :slight_smile: