Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Can I configure the location of the packages cache?

Discussion in 'Package Manager' started by JimmyCushnie, May 6, 2018.

  1. JimmyCushnie

    JimmyCushnie

    Joined:
    Jun 7, 2017
    Posts:
    157
    Is there any way to configure where packages are downloaded to and stored?
     
    WolfDreamer and Noisecrime like this.
  2. DanielTG

    DanielTG

    Unity Technologies

    Joined:
    Feb 15, 2018
    Posts:
    109
    Hi Iamsodarncool,

    Thanks for the feedback. Unfortunately we don't currently support the option to change the default package cache on your system but I'll take note of the request and see what we can do for a future release.

    Please keep the feedback coming.

    Thanks,
    Daniel
     
    Noisecrime and JimmyCushnie like this.
  3. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    1,568
    Please make this a priority. Ever since the introduction of the AssetStore developers have been requesting the ability to specify the location of asset package downloads to no avail. Personally I despise that assets ( data ) are 'polluting' my C drive, especially as its only a 256Mb SSD where the cost of space is at a premium. I already have over 4GB of asset store packages and no doubt the new package cache itself will soon balloon in file size too. Being able to specify it use a location on my 2TB other drive would be so much better.

    Also in terms of features i'm wondering if a nice inbuilt back up system would be beneficial. I already make back ups of asset store packages by hand, and just completing an editor tool to do this automatically. Simple reason being that internet connection is not a given, even in the UK periodically I lose internet in off hours while the ISP does updates or housekeeping. In addition as much of my client work involves installing on-site and sometimes needing to make updates, having local back ups of older versions would be a nice safety net.
     
  4. DanielTG

    DanielTG

    Unity Technologies

    Joined:
    Feb 15, 2018
    Posts:
    109
    @Noisecrime
    Thanks for the feedback as well. Re: Customizing the package cache location. In the short term, it will hopefully not be a major issue even with a small local HD since the number of new ackages and overall size is relatively small. However, yes it's definitely an important point for us to address moving forward as we onboard more packages internally and from 3rd parties.

    Re: backup system. It's noted and I'll review with the team. Are you looking for something along the lines of a "Project" backup/archive or more system wide in terms of Packages?

    Thanks
    Daniel
     
    Noisecrime and JimmyCushnie like this.
  5. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    1,568
    I think more global in nature, just so you can easily have backup of packages to take onsite, or be able revert to earlier versions etc. Again most beneficial when the internet might be unavailable, or as is often the case onsite can be intermittent or low bandwidth.

    thanks.
     
  6. Gru

    Gru

    Joined:
    Dec 23, 2012
    Posts:
    142
    Just found this as I was about to post the same request.
    I think it is important to have a setting for where things are installed and downloaded. It especially applies for users with SSDs. This includes:
    • Asset Store Local Packages: most people don't want that on C:, since some packages are huge (I've downloaded several GB in size) and it is not clear if these folders are safe to delete. Unity should consider a UI window for this, with the ability ton change the path and delete the cached packages from the UI.
    • GI Cache.
    • Package Manager packages. With multiple versions and 3rd party packages this will become important too, since we can't actually erase those like we could with Asset Store Packages Cache now.
    • Place where new Unity Versions are installed with Unity Hub. Some versions we want in the default (preferred) path, presumably on C:, and some we don't. So, for example in my case, main project Unity version will go on C:, betas and legacy support versions will not. One solution would be to offer a list of install locations defined by the user, and for every new installation if there is more than one install location defined we should pick which one we want for this specific version. As it is today, it is actually more convenient to not use Unity Hub, since we can at least manually choose where things are installed.
     
    Noisecrime and JimmyCushnie like this.
  7. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    2,960
    I usually solve this with symlinks. Occasionally an app may have really terrible symlink support and screw everything up, but that’s pretty rare on macOS and Linux.
     
  8. WarpforgedGames

    WarpforgedGames

    Joined:
    Dec 13, 2017
    Posts:
    1
    Moreover, this violates a software development tenet: Ideally, all code dependencies (with possible exception of platform/sdks) reside under source control for a given project. It is often the case that third party code is modified/fixed. It's ok to have a (optional) cache in the User's profile folder, but packages referenced by projects need to live under the project folder or at the least, we need an option to reference/download them there. If this isn't already implemented, please prioritize.

    - appreciated
     
    bgrz, Noisecrime and JimmyCushnie like this.
  9. Paul_Bronowski

    Paul_Bronowski

    Joined:
    Sep 3, 2014
    Posts:
    55
    FWIW, SymLinks(Junctions, reparse points, etc.) can burn you. In particular, the new (forced) Windows Feature Pack updates are not simple in-place patches. They are clean Windows installations with user migration. Problem is that they often won't respect your junctions, particularly in Program Files and Program Files (x86) and other 'system' folders. Your content might be orphaned and junction obliterated, or Windows setup could fail completely (over and over and over and over). The constrained SSD C: problem is something the Windows and Visual Studio groups are aware of and they are taking some steps to try to change things, but it's not easy. So, be aware and careful if redirecting special system folders.
     
    Noisecrime likes this.
  10. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    2,960
    Maybe that's a problem unique to Windows. The other platforms supported by Unity treat symlinks as whatever they're pointing to.
     
  11. Paul_Bronowski

    Paul_Bronowski

    Joined:
    Sep 3, 2014
    Posts:
    55
    It's not a problem with reparse point implementation on Windows. It functions similarly to other OS'es in that respect. Windows setup, during major feature upgrade (with user migration) deletes them and re-creates them as simple directories, because it is not checking if they are reparse points and doesn't re-create them as such.
     
  12. zetaFairlight

    zetaFairlight

    Joined:
    Apr 26, 2018
    Posts:
    11
    It's the one and only reason we don't buy Unity... not even a safe workaround.
     
  13. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    430
    > In the short term, it will hopefully not be a major issue even with a small local HD since the number of new ackages and overall size is relatively small.

    I've just checked and the cache directory was 2.5Gb

    May I suggest this is now a high priority?
     
    Noisecrime, alexzzzz and JimmyCushnie like this.
  14. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,439
    Mine is ~1Gb right now but I clear it up from time to time. My SSD is 128Gb, and there's usually only about 10Gb of free space available.
     
  15. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    730
    3darkman and andybak like this.
  16. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    1,568
    Hmm I missed this update, but glad I checked as my cache is now sitting at 7 GB!
    Packages are 3.7 GB and npm is 3.3 GB.

    Looks like i'm being punished for being early adopter and experimenting with new packages and that I regularly switch between multiple versions of Unity.

    Edit:

    So let me see if I've got this right.

    I can delete both npm and package folders from the cache and face no consequences, other than Unity having to download and decompress packages on demand on a per project basis?

    I can delete packages folder and will NOT lose any package data as the compressed versions live in npm folder. Thus there is no risk and only downside is that Unity will have to decompress packages on demand per project.


    As for the future, the explosive growth of the cache would indicate that Unity needs to take steps to address the problem. Maybe some efforts have already been made, but as of 2018.4 I couldn't find any means to clear the cache at all, let alone in an intelligent way.

    What I think we need

    A means of clearing the cache from within Unity ( preferences ) with options to
    • Clear all - explain danger of losing npm versions.
    • Clear packages only - and explain there is no danger of data loss.
    Ideally we'd then have filters on top of this to
    • Clear by date.
    • Clear non-verified packages if a verified package exist.
    • Clear oldest previews.
    In addition it would be great to add additional support along the lines of adding a file to the cache that will track package usage by project name. This would provide a means for users to examine on a per package version basis the frequency of its use and which specific projects. That way they can be more informed in terms of deciding whether to delete npm packages or not.

    Thinking about it perhaps working in reverse of the last paragraph might be better, that in a project you can via the package manager mark all the used packages as 'essential'. This will then store this information in a database that all the packages in this project must be kept and never removed via 'Cache clearing'. The database entry will be kept in sync with the project so it will track changes to packages or versions used.
     
    Last edited: Jul 3, 2020
  17. Dostac

    Dostac

    Joined:
    Mar 10, 2019
    Posts:
    1
    --------------------------------------------------
    Has this been fixed? i have 0 bytes left on my c:/
    Litterally cant work on the project now
     
  18. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    730
    Hi @Dostac ,

    The only way to configure the Package Manager global cache location, for now, is through environment variables. See the documentation for more details.

    Make sure to restart the Hub and Unity to get the en var properly propagated.

    Regards,

    Pascal
     
    JimmyCushnie likes this.
  19. PaulRdy

    PaulRdy

    Joined:
    Jun 26, 2015
    Posts:
    14
    Heya just wanted to add to this: Now that the package manager also downloads assetstore purchases there should definitely be some way to change this folder's location via UI. Just got confused for about 2h because I couldn't figure out why Unity wouldn't let me extract a package (C:// volume full)
     
  20. darshie1976

    darshie1976

    Joined:
    Jun 11, 2008
    Posts:
    931
    Just FYI, I think I filed a report for the issue like 6 years ago; and I was told "we are looking into it".

    Not sure what is so hard in implementing a simple path string for the packages; I can have projects saved wherever I want. and same for my GI cache, so the same should go for packages from the store. I find excessive to ask me to create a symlink to another drive, just because there is no option to specify the packages cache, except in your main drive.

    It is one of those low-hanging fruits that takes very little to be put in place, and it has quite a large impact for many users that like to work offline and have their whole asset library with them.
    Also imagine the case where you replace your main drive... you need to download everything again, while you could simply point Unity to the external drive location.

    My assets library from the store is quite large; not sure about everyone else, so that would really be a useful thing to have.
     
    majorgrubert and Noisecrime like this.
  21. datRebb

    datRebb

    Joined:
    Apr 4, 2017
    Posts:
    1
    Just adding my "Yes please" to this. Currently fighting my UserData Partition because it's years old and getting too small.
     
    majorgrubert likes this.
  22. Shaunyowns

    Shaunyowns

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    325
    Just a note that I've sent over the most recent responses to the team to see if I can get a response on this.

    I hope this helps everyone!
     
    majorgrubert and Noisecrime like this.
  23. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    142
    @darshie1976,

    I agree this feature sounds like a good bang for the buck. I have checked with product management and unfortunately I cannot commit to anything regarding our roadmap but I can tell you we're aware of the issue.

    Sam
     
    Noisecrime likes this.
  24. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,589
    The solution for now is to use Symbolic Links. They are like shortcuts, except windows recognises them as the actual folder.

    Get this shell extension. The website looks like it's from 1998, so you know the software works.
    1. Close Unity/Hub.
    2. Create two folders on your desired hard drive, such as
      E:\Unity\AppDataLocal
      and
      AppDataRoaming
      . Note: Some unity folders have stupidly long names, so make this folder near your root.
    3. Cut + Paste the Unity folder from
      C:\Users\_Username_\AppData\Local\Unity
      to
      E:\Unity\AppDataLocal
      .
    4. When finished, right-click-drag the Unity folder back into
      C:\Users\_Username_\AppData\Local
      and choose
      Drop Here > Symbolic Link
      . Note: You will need two windows open for this, or, alternatively, I think you can cut+paste the symbolic link anywhere you want after creation.
    Repeat for the stuff in
    C:\Users\_Username_\AppData\Roaming\Unity
    .

    Now you have saved 7GB+

    Other spam you might want to move:
    AppData\Local\unityhub-updater

    AppData\Roaming\UnityHub

    AppData\Roaming\Unity Hub
    (with a space this time).
     
    Last edited: Nov 4, 2020
unityunity