
10 Answers
10Did you create a custom UnityEditor script? If you did, you need to move it to another project that sits outside of your main project. For example, I had a PopupScriptableEditor.cs file in my main project âAssembly-CSharpâ. I moved that script into my âAssembly-CSharp-Editorâ project. The issue is that the âPlayerâ or your main project is trying to build but there is an âEditorâ script, that is also trying to be compiled at the same time and itâs not allowed.

Hi,
this thread is old, but I have something to add. I encoutered the same error and none of these tips worked for me. I have made a Post on Itch.io about what happened and how I fixed it, if you want the full story.
In short: Go to âC:\Users{YOUR USERNAME HERE}\AppData\Local\Unity\Editorâ and look into the editor.log file after the failed build attempt. There is a more detailed failure description and in my case this helped me to find my error. If you canât see the file, activate âShow hidden filesâ because it is hidden.
This worked for me, thanks. I had some erroneous using statements in a few of my scripts.
â rgrlee71Found a solution-
https://forum.unity.com/threads/i-cant-build-my-game.803667/
I had few scripts with âusing Editor;â in them which were not part of an Editor assembly definition.
After refactoring and moving editor scripts to editor assembly definition and monobehaviour scripts to normal assembly definition, it worked.
@geekm
I donât have a Using line for it, but I do use a method from it. It allows my exit method to handle being in the Unity editor. So I leave the code there, but disable it with a #if:
public void ExitGame()
{
if (Application.isPlaying & !Application.isEditor)
Application.Quit(); // We may return from this, but the program will terminate at the end of the frame
#if false
else
UnityEditor.EditorApplication.isPlaying = false; // Handle being in the editor, but set #if to true to use it
#endif
}// ExitGame()
Once I removed this line, the problem went away:
using UnityEditorInternal;
Thank you for your help.
Iâm having the same problem and Iâve tried anything that says âusing UnityEditorâ so now the only things with it are the packages that are installed by default. Iâve used WebGL on some other projects and itâs worked fine and the only difference I can think of is that this one uses MLAPI. Does anyone know if this makes a difference?
I just had this happen. Iâve been building without error for a long time. I looked at the most recent scripts I was working on and found that to one a wacky using statement (something to do with Graphics)
had somehow been added to the top of the script along with the other using statements. It was nothing I had added intentionally. After I deleted it, I was able to build.
@walkinghat that's exactly it! just remove the line: using UnityEditor.Experimental.GraphView; to fix the error, in my project, this line was in the EnemyAI class.
â DatsplayThe cause of the issue is beacause you use UnityEditor in your script but this script is not in Editor folder.
To fix this issue, do this :
- Find all scripts containing âusing UnityEditorâ
- Move all these scripts to an Editor folder. Create this folder if necessary
You can now generate your build.
I got the solution that unity tell you there is some scripts has errors you should delete it and delete the GI cash⌠thatâs helped me
alt text
unity cannot build player while editor is importing assets or compiling scripts
Using blot
Using UnityEngine
If I delete this, it doesnât work. How do I fix it?
The same problem in Unity 2019.3 Answer by ryjoe1312 has nothing in common with it
â AnriCZDid you solve this? I have the same issue.
â manuegeI'm facing the same problem. Any solutions?
â Pbasnal17I got the solution that unity tell you there is some scripts has errors you should delete it and delete the GI cash.. that's helped me
â masmear