Search Unity

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,307
    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:
    756
    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
     
    Zyblade, dshimmyo and jashan like this.
  3. lilymontoute

    lilymontoute

    Joined:
    Feb 8, 2011
    Posts:
    1,181
    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,307
    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:
    555
    @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:
    555
    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,307
    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.
  8. Jeryl

    Jeryl

    Joined:
    Sep 18, 2015
    Posts:
    45
    Hi @maximeb_unity I have a similar problem with the TextMeshPro package. In my case, the file already appears to be in the Package folder (just started with the package manager so I could be wrong, see the screenshot) but everytime I restart Unity, the change is gone. It didn't happen in 2018.x.

    Also if you can contact the TMP team about making a change it would be great : in line 112 of the TMP_Text.cs file, is it possible to make the string "virtual" by default so that the RTL asset can override it without hassle?
    Thanks


    Capture d’écran (231).png
     
  9. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    555
    Hi @Jeryl,

    All packages are listed under "Packages" in the Project window, but packages may actually be physically located in various locations on disk, depending on their source. In order to make changes to a package, you need to embed it, which is done by copying *all its contents* under a folder in your project's Packages directory and clearing the read-only flag from all its files. Otherwise, it is in a cache, and there are various opportunities that the Package Manager will use to "repair" the package (such as when opening the project), which will revert any changes.

    Note: Future Unity versions will include UI and C# APIs to manage embedded packages more easily. The manual steps described above are a means to achieve the same result until then.
     
  10. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Does it have to be in that location (under Packages in the projects folder)? I'm using quite a few packages from GitHub and have those in a separate folder (shared between multiple projects), but so far, it all seemed to work well.
     
    Last edited: May 9, 2019
  11. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    555
    Hi @jashan,

    In order to be recognized as an embedded package, yes it has to be there. However, if you just want to use packages from GitHub you can either add them as Git dependencies (in which case they will be copied to your project cache, and also be immutable) or a local file dependencies (in which case they will be fully mutable, so usable for development purposes).

    To find out more about either option (including limitations), you should read the Local paths and Git URLs sections of the manual at https://docs.unity3d.com/Manual/upm-dependencies.html).
     
    jashan likes this.
  12. Jeryl

    Jeryl

    Joined:
    Sep 18, 2015
    Posts:
    45
    maximeb_unity and jashan like this.