Unity 5 Beta 14 (64-bit) - Game Project Fails To Build (WebGL)

When I try to build a game project for WebGL, I get the following errors in the console after the “Convert and compile scripting files” phase of the build process:

–copy-level=None “C:\Users\User\Documents\Jubilee Project\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll” “C:\Users\User\Documents\Jubilee Project\Temp\StagingArea\Data\Managed\Assembly-CSharp-firstpass.dll” “C:\Users\User\Documents\Jubilee Project\Temp\StagingArea\Data\Managed\Assembly-UnityScript.dll” “C:\Users\User\Documents\Jubilee Project\Temp\StagingArea\Data\Managed\Assembly-UnityScript-firstpass.dll” “C:\Users\User\Documents\Jubilee Project\Temp\StagingArea\Data\Managed\UnityEngine.UI.dll” “C:\Users\User\Documents\Jubilee Project\Temp\StagingArea\Data\il2cppOutput”
UnityEngine.Debug:LogError(Object)
UnityEditorInternal.Runner:RunManagedProgram(String, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:54)
UnityEditorInternal.IL2CPPBuilder:ConvertPlayerDlltoCpp(ICollection1, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:383) UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:264) UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:204)
UnityEditor.HostView:OnGUI()

AND

Error building Player: Exception: C:\Program Files\Unity 5.0.0b9\Editor\Data\PlaybackEngines\webglsupport/BuildTools\il2cpp/il2cpp.exe did not run properly!

Anyone know what is causing all those errors?

I have same problem.

If you look at console, you’ll see interesting log before errors

stdout:
stderr:

Click on it and real problem (maybe) is

System.InvalidCastException: Cannot cast from source type to destination type.
  at Unity.IL2CPP.Common.TypeReferenceComparison.TypesMatch (Mono.Cecil.GenericParameter a, Mono.Cecil.GenericParameter b)

I already reported bug, but it is not fixed in b15. But you can use b13.

I’m having same IL2CPP problem in b14 trying to build WebGL. I also sent a bug report.

Unhandled Exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.InvalidCastException: Cannot cast from source type to destination type.
at Unity.IL2CPP.Common.TypeReferenceComparison.TypesMatch (Mono.Cecil.GenericParameter a, Mono.Cecil.GenericParameter b) [0x00000] in :0

You say beta 13 worked for you? I’ll try that too.

Just adding my 2 cents. Beta 15 also has this issue. Beta 13 will build my project but Beta 14 and 15 will not. I’ve submitted a bug for it. There are also some other WebGL issues I’m finding… some of them Reflection but others a bit different. I haven’t narrowed it down completely yet but it looks like attempting to invoke a member on (at least some) interfaces throws an exception. I believe in my case it’s happening when trying to add an item to an IList parameter which is constructed outside of the method as a List.