Hey guys, getting an error message to build the project after clicking “Reimport All” for some reason. I’m using unity version 2022.3.20f1, polyspatial 1.0.3 and XR Plugin for vision 1.0.3.
The error starts like this: Building Library/Bee/artifacts/iOS/ManagedStripped failed with output: /Applications/Unity/Hub/Editor/2022.3.20f1/Unity.app/Contents/il2cpp/build/deploy/UnityLinker --allowed-assembly=/Applications/Unity/Hub/Editor/2022.3.20f1/PlaybackEngines/VisionOSPlayer/Variations/il2cpp/Managed/UnityEngine.AIModule.dll --allowed-assembly=/Applications/Unity/Hub/Editor/2022.3.20f1/PlaybackEngines/VisionOSPlayer/Variations/il2cpp/Managed/UnityEngine.ARModule.dll
And then there’s just a massive string that says the output was truncated. The project was building before…
I tried “Reimport All”, deleting the library folder, reimporting polyspatial and changing the Unity version.
Looking at the full output in Editor.log was interesting. There I can read that the error is caused by
Failed to resolve assembly: ‘WindowsBase, …’
Fatal error in Unity CIL Linker
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'
at Unity.IL2CPP.Common.MissingMethodStubber.GetTypeModule(TypeReference type, IEnumerable`1 assemblies) in /Users/bokken/build/output/unity/il2cpp/Unity.IL2CPP.Common/MissingMethodStubber.cs:line 178
at Unity.Linker.Steps.AddUnresolvedStubsStep.MarkAssemblyOfType(UnityLinkContext context, TypeReference type) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/AddUnresolvedStubsStep.cs:line 18
at Unity.Linker.Steps.Marking.UnresolvedStubMarking.HandleUnresolvedType(TypeReference reference) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/Marking/UnresolvedStubMarking.cs:line 96
at Unity.Linker.Steps.UnityMarkStep.HandleUnresolvedType(TypeReference reference) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 207
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1406
at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1293
at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet`1 typesAlreadyVisited) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 315
at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 1159
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 204
at Unity.Linker.Steps.UnityMarkStep.InitializeAssembly(AssemblyDefinition assembly) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 34
at Mono.Linker.Steps.MarkStep.Initialize() in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker.Steps/MarkStep.cs:line 194
at Unity.Linker.Steps.UnityMarkStep.Process(LinkContext context) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker.Steps/UnityMarkStep.cs:line 255
at Unity.Linker.UnityPipeline.ProcessStep(LinkContext context, IStep step) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityPipeline.cs:line 22
at Mono.Linker.Pipeline.Process(LinkContext context) in /Users/bokken/build/output/unity/il2cpp/repos/monolinker/src/linker/Linker/Pipeline.cs:line 128
at Unity.Linker.UnityDriver.UnityRun(UnityLinkContext context, UnityPipeline p, LinkRequest linkerOptions, TinyProfiler2 tinyProfiler, ILogger customLogger) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 160
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(TinyProfiler2 tinyProfiler, ILogger customLogger) in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 100
at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling() in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 68
at Unity.Linker.UnityDriver.RunDriver() in /Users/bokken/build/output/unity/il2cpp/UnityLinker/Linker/UnityDriver.cs:line 49
I still don’t know how to solve this. But maybe you @guubebra and @flashno can check your Editor.log files and see if it the same error in your cases. - And hopefully this helps finding a solution for us.
My “solution” was unfortunately creating a project from scratch and importing all my project files as a unity package, this worked. I still don’t know why the error occured even if I deleted my whole Library folder. Sorry not being able to help too much.
I figured out how to fix this. Just go to your log file and you should see some library that’s causing the issues. Mine was a deeplinking library that I had to delete from Assets>plugins. Log is located on mac in Library > Logs > Unity >Editor.log. Hope this helps!
Unity can successfully build after I set the Managed Stripping Level to Medium or High.
Go to Project Settings > Player under Optimization you can find the Managed Stripping Level. The default value is Minimal.
I guess, that the higher the level is set, the closer the linker (?) checks whether or not some code is actually used for the current build. Minimal or Low are not enough. Only with Medium or High the linker (?) realizes that we don’t need WindowsBase.dll for our visionOS build.
In my case, it was happening because one of my Runtime AssemblyDefinitions for Unit Tests was missing the UNITY_INCLUDE_TESTS in the DefineConstraints causing the nunit.framework reference to get built and trigger build errors.