Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Unity 2019.1: Package Manager resetting all packages on every start?

Discussion in 'Package Manager' started by jashan, Feb 10, 2019.

  1. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,054
    I originally posted about this in the Visual Effect Graph thread, but it's probably actually a Package Manager issue: I just updated to Unity 2019.1 (2019.1.0b2) and in the current VFX Graph packages (5.2.3, 5.2.1, 5.2.0) there's a compilation error. That compilation error is trivial to fix but each time I close and re-open the project in Unity, Unity seems to try to be "smart" and overwrites my fix.

    I'm not sure why the package manager does this - I only know that it almost certainly didn't do this in earlier versions, and this will break VR support for the HDRP render pipeline because that requires changes being applied to the files in the package.
     
  2. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    443
    Hi @jashan,

    If we you change the source file located under the
    Library
    folder, you should not do that. The content of this folder is own by Unity and can be changed at any moment (as you are experiencing). Instead, copy the package under the
    Packages
    folder and then you can safely change the package content. The Package Manager won't change the code. We call this flow *embedding* the package.

    Regards,

    Pascal
     
    jashan likes this.
  3. thinksquirrel_lily

    thinksquirrel_lily

    Joined:
    Feb 8, 2011
    Posts:
    1,168
    A quick question about this... we also modify some files as a hacky workaround in the VFX package since the API isn't public yet (we automate the process so that it accounts for changes from the package manager). If we were to continue to automate this, it possible to selectively overwrite files under the Packages folder? Or do we need to do a comparison, copy everything if needed, then modify some files?

    Finally, does the manifest need to be changed in this case (copying the folder to
    Packages
    )?
     
    Last edited: Feb 11, 2019
  4. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,054
    Hi Pascal,

    Thank you for the clarification. How about using Git support? Would that keep the changes?

    But as I understand "no subfolder support", I guess this couldn't be used for the Scriptable Render Pipeline, anyways (because the actual packages are subfolders of the repository).

    So I guess I'll stay with my approach of using local file references with folders that are synchronized via git. One thing that would be really helpful for that is if the package definition files would have a property for "official, authoritative source on GitHub", if one exists. Something like:

    Code (CSharp):
    1. {
    2.     "name":"com.unity.visualeffectgraph",
    3.     "displayName": "Visual Effect Graph",
    4.     "version":"5.4.0-preview",
    5.     "unity": "2019.1",
    6.     "unityRelease": "0b1",
    7.     "description":"The Visual Effect Graph is a node based visual effect editor. It enables artists to author next generation visual effects simulated directly on GPU",
    8.     "source": "https://github.com/Unity-Technologies/ScriptableRenderPipeline/tree/release/2019.1",
    9.     "keywords":[
    10.         "vfx",
    11.         "visualeffect",
    12.         "graph",
    13.         "effect",
    14.         "particles"
    15.     ]
    16. }
    "source": "https://github.com/Unity-Technologies/ScriptableRenderPipeline/tree/release/2019.1",

    Notice that I have included the branch in the URL. As
    com.unity.visualeffectgraph
    is part of ScriptableRenderPipeline, it just has that as source; so the "source"-property would be the same also for
    com.unity.render-pipelines.core
    ,
    com.unity.render-pipelines.high-definition
    and so forth.
     
  5. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    65
    @jashan,

    The issue has been identified and fixed by the SRP team. I'm not sure when it will be available, however, but it will likely be in an upcoming release of the VFX Graph package.

    Regarding your other questions... For your case I believe using a Git-based package would do the trick, albeit not with the current SRP repo, as you figured out, due to the package being nested inside the repo instead of being located at the root.

    Newer packages do include a "repository" attribute, which provides information about the type of VCS (currently only `git` it used), the URL, and the VCS-specific revision ID. That information is added by our publishing pipeline, and it's a more or less recent change to the pipeline, so older packages won't have that information. The URLs are formatted entirely in "Git-speak", unlike the example URL you provided, so it can be passed to Git directly, independently of the remote Git repository's Web UI (which is what your example link points to).
     
    Last edited: Feb 11, 2019
  6. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    65
    Hi @thinksquirrel_lily,

    It's not possible to selectively overwrite files; you need to copy the whole package contents to the
    Packages
    directory, a process we call "embedding" the package in your project. An embedded package can be modified, but it has to be added to source control, or otherwise included with your source files when you share/distribute your project. Embedding a package is currently done manually, but we're working on making this functionality available from the Package Manager window.

    When you embed a package, you don't need to alter the
    manifest.json
    file. The embedded package simply overrides whatever is specified in the manifest during dependency resolution, i.e. the entry for that package in your manifest is ignored, if present. There doesn't even need to be an entry present.
     
  7. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,054
    That sounds perfect to me! Makes sense to use a "machine-readable format" handled well by Git. I guess in many cases, we'll simply copy'n'paste those URLs into the command line ;-)
     
    maximeb_unity likes this.