ArgumentException: The specified path is not of a legal form (empty)

I get an error (seen below) whenever I attempt to do a build of the project.

Has anyone encountered this problem before? If so, how did you get around it?

Unity Version: 2020.3.48f1
Burst Version: 1.8.4
ArgumentException: The specified path is not of a legal form (empty).

System.IO.Path.InsecureGetFullPath (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0) System.IO.Path.GetFullPath (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0) Unity.Burst.Editor.BurstLoader.TryResolvePath (System.String path, System.Collections.Generic.Dictionary`2[TKey,TValue] packagesLookup, System.String& resolvedPath) (at Library/PackageCache/com.unity.burst@1.8.4/Runtime/Editor/BurstLoader.cs:554) Unity.Burst.Editor.BurstLoader.GetAssemblyFolders () (at Library/PackageCache/com.unity.burst@1.8.4/Runtime/Editor/BurstLoader.cs:493) Unity.Burst.Editor.BurstLoader…cctor () (at Library/PackageCache/com.unity.burst@1.8.4/Runtime/Editor/BurstLoader.cs:136) Rethrow as TypeInitializationException: The type initializer for ‘Unity.Burst.Editor.BurstLoader’ threw an exception. Unity.Burst.Editor.BurstAotCompiler.OnPostBuildPlayerScriptDLLsImpl (Unity.Burst.Editor.BurstAotCompiler+BurstAOTSettings settings, UnityEditor.Compilation.Assembly[ ] playerAssemblies) (at Library/PackageCache/com.unity.burst@1.8.4/Editor/BurstAotCompiler.cs:449) Unity.Burst.Editor.BurstAOTCompilerPostprocessor.DoGenerate (UnityEditor.Compilation.Assembly[ ] assemblies) (at Library/PackageCache/com.unity.burst@1.8.4/Editor/BurstAotCompiler.cs:265) Unity.Burst.Editor.BurstAOTCompilerPostprocessor.OnPostBuildPlayerScriptDLLs (UnityEditor.Build.Reporting.BuildReport report) (at Library/PackageCache/com.unity.burst@1.8.4/Editor/BurstAotCompiler.cs:189) UnityEditor.Build.BuildPipelineInterfaces.OnPostBuildPlayerScriptDLLs (UnityEditor.Build.Reporting.BuildReport report) (at <25578071f6e44201aac745680e5c8dfc>:0) UnityEditor.BuildPipeline:BuildPlayer(EditorBuildSettingsScene[ ], String, BuildTarget, BuildOptions)

Are you using burst? If so, make sure all the parts of it are up to date and compatible with your version of Unity.

If you’re not using burst, remove it.

Extra unwanted packages in new projects (collab, testing, rider and other junk):

About the fastest way I have found to make a project and avoid all this noise is to create the project, then as soon as you see the files appear, FORCE-STOP (hard-kill) Unity (with the Activity Manager or Task Manager), then go hand-edit the Packages/manifest.json file as outlined in the above post, then reopen Unity.

Sometimes the package system gets borked from all this unnecessary churn and requires the package cache to be cleared:

Hi Kurt, thanks for the reply!

Burst is needed in the project, I’ve also cleared the package cache and still produces the same error. What’s also strange is re-adding Burst, after removing it, in my package manager gives me the same error above (which is ArgumentException: The specified path is not of a legal form (empty). ).

I’m currently deleting and reinstalling/reimporting everything again and hoping it fixes the problem.

Sounds like maybe you’re using wiggy-whacky characters in your path.

If that’s the case, don’t do that. Use only A to Z and 0 to 9 in directory / file / path names.

How to troubleshoot build failures:

First, make a blank project with a single blank scene and prove that it builds successfully.

If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

Until you can build a blank project to the target platform, don’t fiddle with anything else.

Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

Most often things that prevent building are third-party libraries such as Firebase.

Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

Android build not building:

Recently (circa July 2022) there have been reports of Unity’s installer failing to install the Android Tools.

Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022:

Android Gradle errors and other related stuff:

1 Like

I can build a blank project fine, though as you said, I did add Burst 1.8.4 and displayed the same error without even building it.

What seem to worked on the blank project and the current project (and their standalone builds) are Burst 1.6.6 and Burst 1.8.0. Burst 1.8.1 up to 1.8.4 does not work as they give compiler errors.

So, I think I’ll go with Burst 1.8.0 instead.

Thanks for the help Kurt!