Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question What's the point of Packages?

Discussion in 'Package Manager' started by Creiz, Dec 10, 2022.

  1. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    125
    Not the actual package manager. That's important.

    I'm talking about the "Packages" section in your asset browser.

    You make a new project, Unity hangs up on "Resolving Packages". Which means it's downloading all the packages you need. But why?

    I thought the point of this whole "Packages" thing was to have one copy of the package somewhere on your disk that could be used for all projects that need it?

    Why do I have to download the whole URP package on each and every project that uses it? Why can't it be somewhere else and every project just references it from there?

    You can't modify them, anyway. So what's the point?
     
  2. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    285
    Not necessarily. Packages are cached to the global package cache, then copied into your project's cache. As long as you don't mess with the global cache and they haven't been cleared by the package manager, packages are only downloaded once. The resolving packages part includes these simple disk copies.
    Locality of all content used by a projects helps. For example, you should be able to stick an imported project onto an external drive and work with it on another machine without doing reimports or redownloading packages since they're already there.
     
    Creiz likes this.
  3. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    125
    Doesn't look like that, though. Well, unless it does take 30~45 minutes to "resolve" a cached package already in the library folder.

    Then again, what you said makes sense. It's just a bit pointless, though. I figure Unity will still re-download the packages on the new machine if it doesn't find them in the "global cache", so we're still at step 1.

    They should just make it globally and allow an "export" if you want to back it up for another machine where they add everything needed.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,054
    What is that "somewhere else" supposed to be?

    If you mean cloud, then it would work the exact same way. Unity needs to compile the scripts in the package, thus it has to download the scripts from the cloud because it needs the script contents to compile them locally.

    One might think that a package could simply be a precompiled DLL that gets referenced. However, every Unity version may have a different compiler, and every build may target a different platform, and every preprocessor define could change what parts of the package code get compiled. You cannot provide a DLL for each of these combinations, so it's best to simply cache those DLLs locally within the project's directory tree.

    Packages are stored locally to each project because the project wouldn't work without them. Imagine coming back to a source-controlled project a couple years later, only to find that a package the project relies on is no longer available online. The whole project wouldn't work anymore!