Cannot build player while editor is importing assets or compiling scripts
Asked Answered
D

10

0

152455-unity-error.png

Dioptric answered 23/2 at 10:43 Comment(4)

The same problem in Unity 2019.3 Answer by ryjoe1312 has nothing in common with it

Limbic

Did you solve this? I have the same issue.

Cnut

I'm facing the same problem. Any solutions?

Universalist

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

Nazi
U
0

Found 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.
@Dioptric

Universalist answered 6/6, 2023 at 2:38 Comment(0)
R
0

Did 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.

158186-capture.png

Restrict answered 16/3 at 16:39 Comment(2)

Heloo how to move script to another project??

Semantic

i mean u just copied or u cut the script?

Semantic
N
0

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

Nazi answered 26/6, 2020 at 13:52 Comment(0)
A
0

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?

Albie answered 29/7, 2020 at 23:29 Comment(0)
H
0

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()
Hexachord answered 23/2 at 10:45 Comment(0)
F
0

Once I removed this line, the problem went away:

using UnityEditorInternal;

Thank you for your help.

Firn answered 23/2 at 10:45 Comment(0)
K
0

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?

Kamseen answered 26/8, 2021 at 16:45 Comment(0)
E
0

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.

Elfriedeelfstan answered 6/11, 2023 at 12:42 Comment(0)
M
0

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.

Mcguinness answered 9/3 at 14:37 Comment(1)

@Mcguinness 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.

Hairspring
G
0

The 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 :

  1. Find all scripts containing “using UnityEditor”
  2. Move all these scripts to an Editor folder. Create this folder if necessary
    You can now generate your build.
Gosplan answered 23/2 at 5:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.