WebGL fails to build

Hello, I made a LEGO microgame in Unity version 2019.4.20f1 (Personal). This is the first time I used Unity.

I am trying to export for WebGL (to upload for the LEGO Ideas contest) but it always fails to build. I can see it processing the files and exporting, but at the end nothing happens and the build folder is empty.
I am running on Windows 10 Home 64-bit.

What I tried so far without success:

  • Moving the whole project from C:/Users/… to my D:/ drive
  • Building inside the project folder
  • Building outside the project folder
  • Building with ‘Strip Engine Code’ unchecked (it was checked is by default)

When I build and run for Windows (.exe) it works just fine.
Hopefully someone can help me before the contest ends :smile:

Here are the error reports:

AssemblyResolutionException: Failed to resolve assembly: 'UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) (at <28cdca1704d2491781795499c297b78b>:0)
Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) (at <28cdca1704d2491781795499c297b78b>:0)
Mono.Cecil.DefaultAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) (at <28cdca1704d2491781795499c297b78b>:0)
Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) (at <28cdca1704d2491781795499c297b78b>:0)
Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) (at <28cdca1704d2491781795499c297b78b>:0)
Mono.Cecil.TypeReference.Resolve () (at <28cdca1704d2491781795499c297b78b>:0)
UnityEditor.MonoAssemblyStripping.DoesTypeEnheritFrom (Mono.Cecil.TypeReference type, System.String typeName) (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEditor.MonoAssemblyStripping.CollectBlackListTypes (System.Collections.Generic.HashSet`1[T] typesToPreserve, System.Collections.Generic.IList`1[T] types, System.Collections.Generic.List`1[T] baseTypes) (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEditor.MonoAssemblyStripping.GenerateLinkXmlToPreserveDerivedTypes (System.String librariesFolder, UnityEditor.RuntimeClassRegistry usedClasses) (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (UnityEditorInternal.UnityLinkerRunInformation runInformation) (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String managedAssemblyFolderPath, UnityEditorInternal.BaseUnityLinkerPlatformProvider unityLinkerPlatformProvider, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, UnityEditor.RuntimeClassRegistry rcr, UnityEditor.ManagedStrippingLevel managedStrippingLevel) (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEditorInternal.IL2CPPBuilder.Run () (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEditor.WebGL.WebGlBuildPostprocessor.CompileBuild (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:387)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:932)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <8d21067e8d9c494db25a2b2485216e63>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Build completed with a result of 'Failed' in 77 seconds (76510 ms)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002bf] in <8d21067e8d9c494db25a2b2485216e63>:0
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <8d21067e8d9c494db25a2b2485216e63>:0
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
[Version and Build] Build failed! 00:01:16.5097933
UnityEngine.Debug:LogError(Object)
Unity.Play.Publisher.Editor.<WaitUntilBuildFinishes>d__7:MoveNext() (at C:/Users/sembr/New Unity Project/Library/PackageCache/com.unity.connect.share@4.1.1/Editor/PublisherBuildProcessor.cs:77)
Unity.EditorCoroutines.Editor.YieldProcessor:MoveNext(IEnumerator) (at C:/Users/sembr/New Unity Project/Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:80)
Unity.EditorCoroutines.Editor.EditorCoroutine:ProcessIEnumeratorRecursive(IEnumerator) (at C:/Users/sembr/New Unity Project/Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:134)
Unity.EditorCoroutines.Editor.EditorCoroutine:MoveNext() (at C:/Users/sembr/New Unity Project/Library/PackageCache/com.unity.editorcoroutines@1.0.0/Editor/EditorCoroutine.cs:115)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

Uninstalling and reinstalling unity and the unity hub seems to have worked, I can now make a successfull build in WebGL.

1 Like

Literally your entire situation, platform, and what you’ve tried matches with what I have LOL.

Did you find another way? I don’t have the option to reinstall…