DirectoryNotFoundException caused by Windows path length limit and addressables during build.

Hi,

We’ve recently found this issue. We’re using the custom Build Server for building our game and we’re also in a process of modifying the game to work with Addressables.

Unfortunately on our build machine (it’s running Windows 10 and Unity 2019.4.10f1) we got an exception during build:

DirectoryNotFoundException: Could not find a part of the path "Assets\StreamingAssets\DefaultAssets\Windows\StandaloneWindows64\spriteatlases_assets_assets\_game\survival\masteratlases\spaceship\shuttleinterior\shuttleinterior.spriteatlas.bundle" or "Temp\StagingArea\Data\StreamingAssets\DefaultAssets\Windows\StandaloneWindows64\spriteatlases_assets_assets\_game\survival\masteratlases\spaceship\shuttleinterior\shuttleinterior.spriteatlas.bundle"
System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) (at <fb001e01371b4adca20013e0ac763896>:0)
UnityEditor.FileUtil.UnityFileCopy (System.String from, System.String to, System.Boolean overwrite) (at <8004fcc221b54f98ba547350ea71d812>:0)

This is caused because the final path to the .bundle in in Temp\ directory (when you add the project path generated by Jenkins) has a length of 266 signs which is over 260 signs limit. We’ve reached this limit when we’ve enabled the Addressable Group to pack it’s assets separately instead of packing them toghether.

Enabling long paths in Windows registry and Group Polices didn’t help, so I think the issue is somewhere in UnityFileCopy() method. From what I know you need to use the //?/ syntax in File.Copy method if you want it to support long paths or maybe the manifest for the Unity Editor itself is not set up to inform windows that Editor supports long paths?

What I want to know is that if there is any other way than trying to shorten the paths in order to make it work at the moment?

I’ll bounce this off the team for some guidance. Which version of Addressables are you using?

Hi,

People are having the same issues here Directory Not Found Exception when building local "Packed Assets" Player Content and here Can't build for OSX from Windows (DirectoryNotFoundException: Could not find a part of the path)

Please look into some of the suggested solutions soon, I’d say this is a major bug that people should not have to dig out workarounds for.

Has there been any movement on this? I am experiencing the same thing using Unity 2019.4

Nothing yet. Which version of Addressables are you experiencing this on?

I’m using Addressables 0.18.13 on Unity 2020.3.f11.

Still getting this bizarre error…

Using the terminal in the scope of the error (while debugging), I can verify that both the Source and the Destination do exist:

The destination path itself is not too long, but combined with Directory.GetCurrentDirectory() it comes to 270 characters:

I could not figure out how to change the filename of the built bundle. The “Simplified Entry Name” option that others had mentioned: I don’t see it anywhere.

However, changing “Bundle Naming Mode” to “Use Hash of Filename” will result in a slightly shorter name, narrowly avoiding the problem.

I do think that the Addressables package should check for long filenames, and give a legible warning, because hunting this down took a lot of time.

Hey all, I thought we had this file path length issue documented but I can’t seem to find it. I’ll make a ticket for us to document the problem and a warning, when built on Windows sounds like a good idea.

1 Like

When using BundleMode=PackSeparately Addressables mirrors the project directory structure and stores the generated bundles under those mirrored folders.That’s a problem too.

Ah, good to know, thanks. I’ll be sure to throw that info into the documentation ticket

Hi guys, do we have fix or workaround for this ?

still a problem

Still a problem yes, unfortunately, so anyone using pack seperately is going to run into this with complex projects. Windows 10 long path is not respected. Only way to update it in C# afaik is some appconfig settings. Don’t see a way to do it in Unity.