Unity WebGL Error - "cannot build player while editor is importing assets or compiling scripts"


Hi folks,

if you got this error:

But your Console looks like this:


Then you have a problem. The same problem as I had.

I just finished my first Alpha build, everything worked fine. The Windows Build worked fine and days ago the WebGL build worked fine too. But out of nothing it did not work anymore. What to do? At first I googled it and found this thread:

Solution in Unity forum

There were provided two ways to fix this:

  • Search for "using UnityEngine" in your visual studio project and delete it where it is not neccessary
  • In parts where it is neccessary move the file out of your project, so it doesn't disturb your building process

For some people this already helped. In my case both did not help. What now? Luckily I had another problem some time ago for which I had to go to the Editor Logfile for the first time in my life. I tried this here too and I found that I had some integration problems with an asset I bought on the Appstore. For those of you who never encoutered this problem, this is how you do it:

Open your Windows Explorer and first of all activate "Show hidden files", because the files we are looking for are hidden. When this is done, go to this path"C:\Users\{YOUR USERNAME HERE}\AppData\Local\Unity\Editor" and look for the file "Editor.log". In that file you find a more detailed log and if you are familar with coding and debugging in general you are also probably able to find your error here.

In my case I have some code integrated which is only used in WebGL an marked with "#if (UNITY_WEBGL && !UNITY_EDITOR)" in the Editor. So while in Editor mode nothing happens with these snippets and sadly I also couldn't see the error also. In my Editor.log they were printed correctly, so I could track em down in my code and fix them.

I hope this helps some of you guys who struggle with WebGL build too. For me this is the part which is the greatest pain in the ass while developing. But for showing a demo of your game it is the best way, so we have to deal with it.

If  you have any further questions feel free to ask.

Get Schachkampf - Fantasy Chess

Buy Now$2.99 USD or more

Leave a comment

Log in with itch.io to leave a comment.