UnityGLTF icon indicating copy to clipboard operation
UnityGLTF copied to clipboard

Error building with Api Compatibility Level ".NET 2.0 Subset" for WebGL

Open NDrexlAxonom opened this issue 8 years ago • 3 comments

I have been running into problems with building my project into webgl using the project currently up on the git. Unity sets the Api Compatibility Level to ".NET 2.0 Subset" by default and I was able to resolve the issue temporarily by switching the Api Compatibility Level to ".NET 2.0" but this makes the build times longer and build sizes larger.

These are the errors I get after it fails to build:

Failed running D:\unity20173\Editor\Data\il2cpp/build/UnityLinker.exe --api=NET_2_0_Subset -out="C:\Users\ndrexl\Downloads\UnityGLTF-master (1)\UnityGLTF-master\UnityGLTF\Temp\StagingArea\Data\Managed\tempStrip" -l=none -c=link --link-symbols -x="D:\unity20173\Editor\Data\PlaybackEngines\WebGLSupport\Whitelists\Core.xml" -f="D:\unity20173\Editor\Data\il2cpp\LinkerDescriptors" -x "C:\Users\ndrexl\Downloads\UnityGLTF-master (1)\UnityGLTF-master\UnityGLTF/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml" -x "C:\Users\ndrexl\Downloads\UnityGLTF-master (1)\UnityGLTF-master\UnityGLTF/Temp/StagingArea/Data/UnityEngine.xml" -x "C:\Users\ndrexl\Downloads\UnityGLTF-master (1)\UnityGLTF-master\UnityGLTF\Temp\StagingArea\Data\preserved_derived_types.xml" -d "C:\Users\ndrexl\Downloads\UnityGLTF-master (1)\UnityGLTF-master\UnityGLTF\Temp\StagingArea\Data\Managed" -a "C:\Users\ndrexl\Downloads\UnityGLTF-master (1)\UnityGLTF-master\UnityGLTF\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll"

stdout: Fatal error in Unity CIL Linker System.NullReferenceException: Object reference not set to an instance of an object. at Mono.Linker.TypeReferenceExtensions.c__Iterator1.MoveNext() at Mono.Linker.Steps.TypeMapStep.TryMatchMethod(TypeReference type, MethodDefinition method) at Mono.Linker.Steps.TypeMapStep.c__Iterator0.MoveNext() at Mono.Linker.Steps.TypeMapStep.MapVirtualInterfaceMethod(MethodDefinition method) at Mono.Linker.Steps.TypeMapStep.MapVirtualMethods(TypeDefinition type) at Mono.Linker.Steps.TypeMapStep.MapType(TypeDefinition type) at Mono.Linker.Steps.TypeMapStep.ProcessAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.BaseStep.Process(LinkContext context) at Mono.Linker.Pipeline.Process(LinkContext context) at UnityLinker.UnityDriver.Run() at UnityLinker.UnityDriver.RunDriver() stderr:

UnityEngine.Debug:LogError(Object) UnityEditorInternal.Runner:RunProgram(Program, String, String, String, CompilerOutputParserBase) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:128) UnityEditorInternal.Runner:RunManagedProgram(String, String, String, CompilerOutputParserBase, Action1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73) UnityEditorInternal.AssemblyStripper:RunAssemblyLinker(IEnumerable1, String&, String&, String, String) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:89) UnityEditorInternal.AssemblyStripper:StripAssembliesTo(String[], String[], String, String, String&, String&, String, IIl2CppPlatformProvider, IEnumerable1) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:82) UnityEditorInternal.AssemblyStripper:RunAssemblyStripper(String, IEnumerable, String, String[], String[], String, IIl2CppPlatformProvider, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:204) UnityEditorInternal.AssemblyStripper:StripAssemblies(String, IIl2CppPlatformProvider, RuntimeClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:114) UnityEditorInternal.IL2CPPBuilder:Run() (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:152) UnityEditorInternal.IL2CPPUtils:RunIl2Cpp(String, IIl2CppPlatformProvider, Action1, RuntimeClassRegistry, Boolean) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:41) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

And I will get this one too:

Exception: D:\unity20173\Editor\Data\il2cpp/build/UnityLinker.exe did not run properly! UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:130) UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1 setupStartInfo) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73) UnityEditorInternal.AssemblyStripper.RunAssemblyLinker (IEnumerable1 args, System.String& out, System.String& err, System.String linkerPath, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:89) UnityEditorInternal.AssemblyStripper.StripAssembliesTo (System.String[] assemblies, System.String[] searchDirs, System.String outputFolder, System.String workingDirectory, System.String& output, System.String& error, System.String linkerPath, IIl2CppPlatformProvider platformProvider, IEnumerable1 additionalBlacklist) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:82) UnityEditorInternal.AssemblyStripper.RunAssemblyStripper (System.String stagingAreaData, 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:204) UnityEditorInternal.AssemblyStripper.StripAssemblies (System.String stagingAreaData, IIl2CppPlatformProvider platformProvider, UnityEditor.RuntimeClassRegistry rcr) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/AssemblyStripper.cs:114) UnityEditorInternal.IL2CPPBuilder.Run () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:152) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, IIl2CppPlatformProvider platformProvider, System.Action1 modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry, Boolean debugBuild) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:41) UnityEditor.WebGL.WebGlBuildPostprocessor.CompileBuild (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:350) UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at /Users/builduser/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:915) UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:272)

I am using Unity 2017.3.1 for this, but I have tested with 2017.3.0 as well.

NDrexlAxonom avatar Feb 15 '18 14:02 NDrexlAxonom

Are you positive this is a problem with UnityGLTF? I don't see any mention of any of our source files in any of that.

stevenvergenz avatar Feb 15 '18 23:02 stevenvergenz

Yes I confirmed it by downloading the up to date recent batch of files uploaded here and just tried to build a Unity WebGL build from the project included (and after building the VS project included to make sure the .dll's are in the correct spot) and it gave me the error above.

In my other project I am using it for, I removed the GLTF plugin altogether and was able to build just fine. Added it back in and it will error with the same error as above.

NDrexlAxonom avatar Feb 16 '18 18:02 NDrexlAxonom

Looks like there's a workaround for this in #138

ericob avatar Jan 02 '19 22:01 ericob