Cannot build for WebGL in Unity

I am done with my game and want to share it. But I cannot build to WebGL. I have no problem building for windows, but when I select WebGL I get a message:
IOException: Win32 IO returned ERROR_ALREADY_EXISTS

I have tried everything I can think of (which is not much) and also updated Unity to latest, but I cannot get it to work. Does anyone know what to do?

Full error:

    IOException: Win32 IO returned ERROR_ALREADY_EXISTS. Path: 
    System.IO.File.Move (System.String sourceFileName, System.String destFileName) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:337)
    UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (IEnumerable assemblies, System.String managedAssemblyFolderPath, System.String[] assembliesToStrip, System.String[] searchDirs, System.String monoLinkerPath, IIl2CppPlatformProvider platformProvider, UnityEditor.RuntimeClassRegistry rcr) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:268)
    UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String managedAssemblyFolderPath, IIl2CppPlatformProvider platformProvider, UnityEditor.RuntimeClassRegistry rcr) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:115)
    UnityEditorInternal.IL2CPPBuilder.Run () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:170)
    UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, IIl2CppPlatformProvider platformProvider, System.Action`1 modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:42)
    UnityEditor.WebGL.WebGlBuildPostprocessor.CompileBuild (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/

Would be great if someone could help me. Thanks!

Hi Harri,

When you select the path to create the build in, are you selecting the same directory as the project?

Hi Rob, Thanks for the reply. I have the project in D:\Repos\Unity3D\2_Terminal_Hacker and I am building to C:\Users\harri\Downloads\Terminal_Hacker.

Would you like me to give it a go at this end, just to rule out the project itself etc.

If the project files are less than 10mb (zipped) you can just upload directly to a reply, if they project files (zipped) are larger you’ll need to use a service such as a Google Drive or Dropbox. Might be an easy first step to diagnose the issue.

Which version of Unity are you using by the way? Oh, and did you installed WebGL as a component during the installation of Unity, or a separate download?

I think that is where I might have screwed things up. I did not include webGL in my initial install. I am now trying to reinstall everything, meaning that I uninstalled what I had and am now installing 2018.2.7f1.

If it doesn’t work, I will share it with you on my Dropbox. :slight_smile:

Hi,

Ok, no problem.

I know quite a few other students have experienced issues with WebGL builds when they have downloaded and installed the WebGL Support separately, different issues, but it seems to be more sensitive. Your error doesn’t really suggest this is the case, I did actually wonder whether perhaps there may be more than one Unity process running and perhaps the file is locked by the other process but again, you’d expect a slightly more relevant error if that was the case.

I will keep an eye on the topic so as to grab your project files if needed :slight_smile:


Updated Fri Sep 07 2018 23:42

One other thing to check, have a look under the Build Settings, do you have Linker Target set to Web Assembly?

image

Thank you. The re-install did not help, but I am wondering if my uninstall really removed enough of Unity for the new install to be fresh.

I have packed the project in a .rar : https://www.dropbox.com/s/ak1n1ajar035l98/Terminal%20Hacker.rar?dl=0

Edit: Yes, Linker Target is WebAssembly

Whilst I’m grabbing your project and opening it, try changing that to asm.js and try the build process again…

Still getting the error, I’m afraid.

Ok, no worries, change it back then.

How soon during the build process does it error for you, I’m building at the moment and so far so good, but it takes a while the first time…

It is quite soon… I have recorded my screen…
https://www.dropbox.com/s/oxc3hy96h8jl4pl/WebGL_build_error.webm?dl=0

Beginning to wonder if it’s still running or actually crashed this end, the builds often do take a while but this seems a bit unresponsive at the moment… it got further than your video however…the crash is likely to be an issue my end… looks like Norton is going nuts at the same time as the build… will try again…

Have you tried a different location for the build at all btw? Maybe create a directory on your desktop and then point it to that, just to see if there’s any different behaviour.


Updated Sat Sep 08 2018 00:14

The last message I saw on your build dialog before it error was “Building a list of referenced libraries”, or words to that effect, at this end it gets passed that, to the “Building native binary” message, but again it has locked my laptop up, CPU at 100%… could just be the first build thing, but seems odd.

Only thing I’ve spotted which looks suspect at the moment is the space in the solution/project name, typically its better to not put any spaces/special characters in the names but may need to reboot my laptop before I can test much further…

I have now tried to rename the project to TerminalHacker and tried a few different locations. I get the same error.

I am trying the following (before a reboot);

  • renamed folder “Terminal Hacker” to “TerminalHacker”
  • renamed solution file to “TerminalHacker.sln”
  • renamed project to “TerminalHacker.csproj”
  • deleted the Library directory
  • deleted the Obj directory
  • deleted the Temp directory
  • re-opening the project - library database rebuilt
  • selected WebGL at the platform
  • clicked Switch Platforms
  • clicked Build

…waiting :slight_smile:

Editor frozen again, CPU maxed to 100%… will leave it for 10 minutes and see if anything happens…


Updated Sat Sep 08 2018 00:41

I will give it another 5 minutes then reboot, there’s a battle going on between Norton and Unity I think…

In the mean time, you could try creating a separate project, just have a scene with a canvas and a text box that says something, then build that for WebGL and see if you get the same issues.


Updated Sat Sep 08 2018 00:54

Rebooted…

Restarted process, it is getting further this time, currently compiling web assembly module which sounds promising.


Updated Sat Sep 08 2018 00:57

image

Let me know how the separate project/build goes and whether you experience the same issue/error with that one. It looks as if the project is ok at least, which perhaps points to local configuration as the next place to look.

I tried with a different project (Number wizard from 2D course) and it builds without problems. I also tried to follow the steps above, but could not find the temp folder… I did the rest of the steps and still get same problem.

That’s interesting, e.g. the other project building.

Ok, so here’s a thought, how about creating a new TerminalHacker project, and once its created the shell, copy the assets from your existing Terminal Hacker project into it, just the assets etc… then try a build.

Very strange. It does not seem to work.

Time to go to bed and give it a new try tomorrow.

Thanks a lot for your help Rob!

hmmm… puzzling…

Ok, night… need to get some sleep too…lol…

I have now tried, as you suggested, to create a new project, and importing the asset file from the course and building the project. I get the same error as before. When deleting WM2000 from assets and building it works.

I am clueless about what to do next. I’ll try to uninstalling and deleting everything that has to do with Unity and reinstalling.

Did you give the project the same name, or something new?

I wonder if perhaps the WM2000 is referencing some other packages which, since the more recent changes to Unity, are also referenced within that, you’ve probably seen the Packages listed under the Project view etc. Clearly clutching at straws a little bit here now.

It would be nice to be able to actually recreate the issue in order to work through it, but as we saw, eventually last night, after my laptop was resuscitated, it did build.

How about creating a set of repro steps for me, including versions of Unity and so on. I will then follow them to the letter, if I am unable to reproduce the same issue it would then seemingly point to your setup at that end. If I can reproduce the issue it will then be easier to start diagnosing it.

Privacy & Terms