Search Unity

[SOLVED] DirectoryNotFoundException with different packages

Discussion in 'Package Manager' started by BTStone, Mar 12, 2019.

  1. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Hey there,

    Unity version: 2018.3.7f1

    Recently I noticed that everytime I install a package from the PackageManager I get a bunch of errors saying that there occurs a DirectoryNotFoundException like this with the Addressable-Package:

    In that very example the file "PooledInstanceProviderBehavior.cs" does exist in my Unity Project. With the Addressable Package I also get a bunch of other DirectoryNotFoundException with other files. And apparently I also can't use the package itself, although it is installed but apparently it's not functional:

    NoAddressables.jpg


    Also, because of these errors I can't enter playmode in the Editor. Gotta remove the whole package for that.

    I noticed that this doesn't happen with a clean project which is located at the Desktop of my machine which implies that the directory can be found because the path is short enough. if that's the case and my other project fails to install the packages correctly because the paths of the files are getting to long:
    what can be done about that besides moving the whole project to another path?
     
  2. ethan_jl_unity

    ethan_jl_unity

    Unity Technologies

    Joined:
    Sep 27, 2018
    Posts:
    104
    Hi,

    I think the cause of this is really just that the files in your project has hit the 260 char path limit.

    https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation

    We encounter it internally sometimes and there's not much we can do about it either. :(

    In terms of ways around it, one option would be just to move the project to somewhere closer to the root, making the path shorter.

    If you are on a new enough version of windows, you can also try enabling long paths in windows 10, which should fix it as well (I have never personally tired it though)

    Best,
    Ethan
     
  3. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Ah yeah, thought so. Well since I'm still on W7...trying to get it closer to the root I guess. Thanks for the clarification.
     
  4. eamonwoortman

    eamonwoortman

    Joined:
    Jan 11, 2017
    Posts:
    3
    Alternatively, on older Windows versions, you could try mapping the Unity project folder to a drive letter. You'll need to remove the package cache so it regenerates the reegistry with the new drive folder path.

    EDIT: If mapping still results in the full paths, try looking into symbolic links, they should behave slightly different if I recall correctly.
     
    qwert024 and BTStone like this.
  5. pappaxray2

    pappaxray2

    Joined:
    Mar 30, 2016
    Posts:
    12
    Tried long paths on Windows 10, doesn't work, I think you need to enable support with the Unity manifest.
     
  6. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    happyfire likes this.
  7. mgmhunt

    mgmhunt

    Joined:
    Apr 1, 2013
    Posts:
    63
    2019 and we still have to worry about path lengths and white spaces...and hacks to get around it....... uuuurgh...

    The symlink (junction) options works. Copy the project folder and paste as a junction (right click) at a lower level in directory hierarchy, after installing the extension.

    http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html#download

    You'll need to re-open the project in Unity for the junction to have an effect. (I re-added Project to Unity Hub using the junction path)
     
    noemis and maximeb_unity like this.
  8. unity_0MsAkGcTYjNzQw

    unity_0MsAkGcTYjNzQw

    Joined:
    Jun 17, 2020
    Posts:
    1
    sometime when your path
    Perfect Answer.i have solved this issue using your solution to this error
     
  9. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    76
    Hey there,
    today I ran into the same problem:

    DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Unity\Hub\Editor\2019.4.15f1\Editor\Data\PlaybackEngines\LinuxStandaloneSupport\Variations\linux64_withgfx_nondevelopment_mono'.

    I enabled long paths in windows 10 and restarted, but it doesn't help. As you can see, the path doesn't belong to the project, but refers to the editor. Using a junction for the editor did't help, because from this it doesn't start the editor, but my hub.

    I'm on Unity 2019.4.15. Trying to build for Linux.

    Any ideas?

    In general I think too, that this is a special task for unity to enable support for long paths as mentioned in the windows requirements.
     
  10. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    I'm keen to pass on the feedback but to get you up and running, could you try in a significantly shorter path even with long paths enabled in Windows just to confirm your issue is related to above?
     
  11. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    From what I see, this path is 143-character long, well below the Windows 260-character limitation. The problem here does not seem to be a path length issue.

    Did you confirm that this folder is present? Did you make sure to install the proper Linux Build Support components when you installed that Unity Editor version in the Hub? (That would be the component named "Linux Build Support (Mono)", since you seem to be trying to build with the Mono backend configured.)
     
  12. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    76
    I'd love to give more information about this, but I can't shorten the path, because it's not written in my code or depended from my project path, but from the installation path from the editor via hub. Or did I misunderstood something?
     
  13. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    76
    Your're right, the folder is not present. I'll check the components and settings and give feedback later.
     
  14. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    76
    Ok, thank @UnityMaru and @maximeb_unity for responding.

    Adding the Linux Build Support (Mono) solved my issue.

    Maybe the error or warning in the build settings could be more helpful. It was my first try for a build for linux. When I choose the IL2CPP scripting backend I get the warning "building Linux IL2CPP requires a sysroot toolchain..." - so I choose Mono and the error was gone but I did not think about the installation modules. At this point there could be also a hint (like a missing platform): "Please add the Linux Build Support (Mono) Module for the choosen Scripting Backend"

    Thank you again.
     
    ri3m, Rispat-Momit and maximeb_unity like this.
  15. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    Glad you were able to get up and running :)
     
  16. Syganek

    Syganek

    Joined:
    Sep 11, 2013
    Posts:
    85
    Hi, we've started to get the same issue because of the path length. It happens to us when we try to build the game.

    We're on 2019.4.10f1. We are currently migrating to addressables and when an addressable group has a Bundle Mode set to Pack Separately it generates a directory structure that is very long which generates path with 266 characters inside the Temp\ directory (when you add the project path as well).

    Having the long paths enabled both in Registry and Group Policies didn't help and the symlinks aren't a solution for us as we are encountering the problem on our Jenkins build machine. Is there anything else we can do except for trying to get the paths shorter?

    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)
     
  17. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Hi @Syganek,

    Sorry to hear you've been having issues with Windows path length. From what I understand, you're hitting the issue when the Addressables package generates paths that are too long. This is related to how the Addressables package works, so you should perhaps head over to the Addressables forum to ask your question. Perhaps the question has already been asked and answered, but if not, you're more likely to get a useful reply there.
     
  18. Epsilon_Delta

    Epsilon_Delta

    Joined:
    Mar 14, 2018
    Posts:
    258
    I encountered this problem today, very sad limitation. Any plans on enabling long paths for Unity in the near future?
     
  19. Muchaszewski

    Muchaszewski

    Joined:
    Sep 23, 2015
    Posts:
    15
    Hi @maximeb_unity

    Is there any plan to rework the addressables paths to not use such long names?
    Example:
    Code (CSharp):
    1. Library/com.unity.addressables/aa/Windows/StandaloneWindows64\houseItem_variants_scenes_assets/scenes/houseItem/houseItem_configs/houseItem_roof_gabel_europeantile_20.unity_a92595a5a96d08594bffd9798961646e.bundle
    As far as I'm concerned this path can be shortened to
    Code (CSharp):
    1. Library/aa/win64/a92595a5a96d08594bffd9798961646e.bundle
    The whole qualified name is not necessary, since you have a unique GUID that has a probability of collision lower than there are stars in the entire universe...
     
  20. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    I cannot speak on behalf of the Addressables team, and unfortunately I'm not aware of their plans or roadmaps. You might want to check if this topic has already been discussed in the Addressables forum, and if not, post your suggestion there.
     
  21. Rispat-Momit

    Rispat-Momit

    Joined:
    Feb 14, 2013
    Posts:
    266
    Switching to MONO in the Player settings solved this issue for me too
     
  22. RubenGarciaHernandez

    RubenGarciaHernandez

    Joined:
    Jan 13, 2022
    Posts:
    6
    I am also affected.
     
  23. DenzelPhilip

    DenzelPhilip

    Joined:
    Apr 14, 2022
    Posts:
    1
    DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Unity\Hub\Editor\2021.3.0f1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\Facades'.
    System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) (at <6073cf49ed704e958b8a66d540dea948>:0)


    please i keep getting this error when ever i open a new project on the editor appi a using version 2021.3.0f1
     
    Minaboya likes this.
  24. AbdurrahmanKhallouf

    AbdurrahmanKhallouf

    Joined:
    Oct 12, 2016
    Posts:
    2
    I solved mine by moving the project from documents to c:/[project folder] it worked. Unity should use windows new shortened paths
     
  25. bumchikiboss

    bumchikiboss

    Joined:
    Mar 17, 2020
    Posts:
    2
    hi,
    I'm also facing the error:

    DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\Unity\Hub\Editor\2022.3.10f1\Editor\Data\UnityReferenceAssemblies\unity-4.8-api\Facades'.