Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[SOLVED] DirectoryNotFoundException with different packages

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

  1. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,070
    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:
    43
    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
     
    BTStone likes this.
  3. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,070
    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.
     
    echuang98 and BTStone like this.
  5. pappaxray2

    pappaxray2

    Joined:
    Mar 30, 2016
    Posts:
    7
    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:
    143
  7. mgmhunt

    mgmhunt

    Joined:
    Apr 1, 2013
    Posts:
    52
    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)
     
    maximeb_unity likes this.