Search Unity

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

Discussion in 'Addressables' started by Syganek, Dec 22, 2020.

  1. Syganek

    Syganek

    Joined:
    Sep 11, 2013
    Posts:
    85
    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:

    Code (CSharp):
    1. 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"
    2. System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) (at <fb001e01371b4adca20013e0ac763896>:0)
    3. UnityEditor.FileUtil.UnityFileCopy (System.String from, System.String to, System.Boolean overwrite) (at <8004fcc221b54f98ba547350ea71d812>:0)
    4.  
    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?
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    I'll bounce this off the team for some guidance. Which version of Addressables are you using?
     
  3. ZAUBAR

    ZAUBAR

    Joined:
    Jun 18, 2019
    Posts:
    53
  4. wrign01

    wrign01

    Joined:
    Sep 28, 2018
    Posts:
    1
    Has there been any movement on this? I am experiencing the same thing using Unity 2019.4
     
  5. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Nothing yet. Which version of Addressables are you experiencing this on?
     
  6. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    232
    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:

    Screenshot 2021-07-21 114452.png


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

     
  7. noio

    noio

    Joined:
    Dec 17, 2013
    Posts:
    232
    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.

    Screenshot 2021-07-21 115107.png
     
  8. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    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.
     
    noio likes this.
  9. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
  10. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Ah, good to know, thanks. I'll be sure to throw that info into the documentation ticket
     
  11. unity_n_rN95v2cIEGlQ

    unity_n_rN95v2cIEGlQ

    Joined:
    Oct 28, 2022
    Posts:
    4
    Hi guys, do we have fix or workaround for this ?
     
  12. geody2000

    geody2000

    Joined:
    Feb 24, 2023
    Posts:
    1
    still a problem