Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Custom package not updating

Discussion in 'Package Manager' started by Wolfoso, Jun 17, 2019.

  1. Wolfoso

    Wolfoso

    Joined:
    Jul 10, 2018
    Posts:
    12
    I've created a custom package and uploaded it on GitHub to privately share with my colleagues. We then added the link to the GitHub Repo in the manifest.json of Packages folder and everything seemed to be working fine: the package was successfully downloaded and all the functionalities were there. When I updated the repository though, restarting the project did not update the package.

    Project folder structure:
    Code (CSharp):
    1.  <root>
    2.    ├── package.json
    3.    ├── package-lock.json
    4.    ├── README.md
    5.    ├── Scripts
    6.    │   ├── Runtime
    7.    │   │    ├── MessagingLibrary.asmdef
    8.    │   │    └── MessagingManager.cs
    9.    │   │    └── MessageType.cs
    10.    │   │    └── NetworkMessageBase.cs
    11.    │   │    └── NetworkOutMessage.cs
    12.    │   │    └── NetworkInMessage.cs
    Manifest line:
    Code (CSharp):
    1.  "com.hevolus.messagingservice": "https://github.com/Wolfoso/MessagingService",
    What am I doing wrong?
     
    Pacosmico likes this.
  2. okcompute_unity

    okcompute_unity

    Joined:
    Jan 16, 2017
    Posts:
    756
    Hi @Wolfoso,

    The Package Manager will lock the Git package to a specific revision in your project. This is to render the resolution of your project dependencies deterministic. It is a mechanism to protect users against out of scope changes that could break your project. To update the project to a different revision, you have two choices.

    1) Re-add the Git package URL in your project through the Package Manager UI (*this UX was added recently in the Package Manager UI)
    2) Open the project manifest (
    Packages/manifest.json
    ) in a text editor, erase the entry for your package in the
    lock
    section.

    Hope this help,

    Regards,

    Pascal
     
    Vladnee and Pacosmico like this.
  3. Wolfoso

    Wolfoso

    Joined:
    Jul 10, 2018
    Posts:
    12
    Hello @okcompute_unity,

    Thank you for your quick reply, that helps a lot. While I can think of a workaround to automate this process, I don't understand why Untiy's default behaviour on Packages would be to lock them. Isn't the whole purpose of packages to act as project addons? Locking a revision should be an option, not the standard, in my opinion.
    All information regarding the package are in the manifest anyway, it would be possible to avoid updating to an incompatible version by just checking that manifest, wouldn't it?

    Thanks again for your time.
     
    ModLunar and transat like this.
  4. okcompute_unity

    okcompute_unity

    Joined:
    Jan 16, 2017
    Posts:
    756
    *Determinism* is a key foundation for the Unity Package Manager. As I said, we don't want people to get their project in a broken state just because they closed and re-open Unity. In our view, it is critical for the lock to be enabled by default to make sure the whole development team has the same behaviour. That said, we do not provide proper UX to easily update _locked_ packages. This is where we need to put more effort. Manually modifying the project manifest is not really nice. Making the *lock* optional could be something to add to the Package Manager. This would be opt-in for sure. Not default. Maybe this makes sense for a prototype project used only by one person?

    Thank you for your feedback!

    Pascal
     
  5. Wolfoso

    Wolfoso

    Joined:
    Jul 10, 2018
    Posts:
    12
    I understand the logic behind it now, it does indeed make sense.
    Guess this solves it then. We'll be looking forward to a lock-toggle functionality!
     
    Pacosmico likes this.
  6. KarolStolaDD

    KarolStolaDD

    Joined:
    Sep 10, 2019
    Posts:
    7
    Or could we just get an "update" button like in the standard packages?
     
  7. andrew-lukasik

    andrew-lukasik

    Joined:
    Jan 31, 2013
    Posts:
    249
    Hi @okcompute_unity. We get determinism part. But please consider adding manual update button (that just deletes this lock, nothing more) because explaining this operation to **every**single**user** (while he expects update button there as well) is exhausting
     
    runette_unity likes this.
  8. Anthony_cts

    Anthony_cts

    Joined:
    Mar 11, 2017
    Posts:
    7
    I think having the update button would be very nice indeed. I am sharing a toolset on github as a UPM package that people can't update without re-adding the repo. I understand that packages shouldn't update automatically, but having an update button would make it so much better UX-wise.
     
    cdr9042 likes this.
  9. Shaunyowns

    Shaunyowns

    Joined:
    Nov 4, 2019
    Posts:
    328
    There is work for this but we currently don't have an ETA on this.
     
  10. Bshsf_9527

    Bshsf_9527

    Joined:
    Sep 6, 2017
    Posts:
    42
    Still no update button,but in unity2019.4 PackageManager support git url those with tag behind and can paste onto it directly, so we can use tag to update custom package ,for example:
    firstly
    use git://192.168.2.234/XCharts.git#1.6.2 to import a custom package,
    then
    use git://192.168.2.234/XCharts.git#1.6.3 to update this package to a newest version

    how to creat custom package and maintain it : https://www.patreon.com/posts/25070968
     
    cdr9042 likes this.
  11. cdr9042

    cdr9042

    Joined:
    Apr 22, 2018
    Posts:
    169
    So Google's EDM4U get to have the Update button and listed versions.
    Image 047.png
    How do they do it? Is it exclusive to Google?
     
  12. Bshsf_9527

    Bshsf_9527

    Joined:
    Sep 6, 2017
    Posts:
    42
  13. Hookkshot

    Hookkshot

    Joined:
    Jan 11, 2013
    Posts:
    27
    IS there and update on this from Unity, Using tags would be a great way to check for updates with out us having to use scoped Registries.
     
  14. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    I'm wondering why this refresh button does not look for updates on my Git packages?
    upload_2021-4-18_17-12-18.png

    I thought it'd see my (same) branch with updates, including an update to the package.json with a new version, and with a new version Git tag.
    These changes should (ideally) notify Unity that there's an update available.

    This is a bummer unfortunately.
    I want it to be easy for my teammates to change these versions if needed, so I really hope this gets improved UX, so even non-technical people can easily see visual feedback that an update (for Git packages) may be available, or even having the option to choose which version to download.

    Thanks for hearing us out, I hope an update comes soon.
     
    Last edited: Apr 19, 2021
    giniwren likes this.
  15. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    Ooh, there seems to be a solution available at https://github.com/mob-sakai/UpmGitExtension

    EDIT: It seems broken on Unity 2021.1+ (as noted by issue #113, and a NullReferenceException in the Unity Console upon installation, with no visual improvements to the Package Manager Window observed, in Unity 2021.1.0f1, for example).

    EDIT 2: Maybe my best option for now is using Git submodules in my project. This means I can choose the "local package" (from disk) option, as shown here in the Unity Package Manager:
    upload_2021-4-19_11-18-59.png

    So whenever I run a Git command to update my submodule/package to a newer version (say like
    git checkout v0.1.1
    ), the file changes in the local package folder notifies Unity to update its corresponding assets representations in the project.

    The benefit of this over using a Git URL directly is that I noticed my manifest.json didn't include a version of the package in its JSON data! (Or feel free to correct me if I'm wrong!)
    With a Git submodule, I can rest assured that the package version is somewhere in version control -- it's in the Git submodule commit hash, so it knows where the package is coming from history/version-wise!
     
    Last edited: Apr 19, 2021
  16. harleydk

    harleydk

    Joined:
    Jul 30, 2012
    Posts:
    41
    2021.2 still a no-go.
    Adding to the choir - should have an update-button like the regular packages.
     
  17. screenshot.png

    You mean like this?
     
    NotaNaN likes this.
  18. harleydk

    harleydk

    Joined:
    Jul 30, 2012
    Posts:
    41
  19. I'm not sure you realize what would that mean. Countless git calls to various repos just so you can see a version number which you can check easily otherwise... I absolutely don't agree with that it is necessary.
     
  20. harleydk

    harleydk

    Joined:
    Jul 30, 2012
    Posts:
    41
    @Lurking-Ninja Well those 'countless calls' would be the exact same procedure as happens with the other packages. I guess I don't see it as a very costly affaire.
     
  21. Arthur-LVGameDev

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    228
    +1. At least provide a 'hook' so our package can decide to check for version updates. It's dumb to have git support but then have to write custom editor code to run a version check + fetch/update.

    At the *very* least, a "Check for Update" button !!! Right now, out of the box, there's literally no way to update your package from the UI short of fully "re-adding" it to the project. Defeats the purpose of package manager supporting git when you have to manually [as a human user!] check for + request updates.
     
  22. One call for the entire list on a Registry page. One call for the entire list of Assets on a My Assets page. One call per Git URL. Not per page. No thank you, I can check the version number myself and tap the Update button when I feel like updating.

    I mean if they make it optional and turned off by default, sure, but they don't do anything optional nowadays, especially not in the package manager.
     
    Last edited by a moderator: Nov 14, 2021
    ysftulek likes this.
  23. Arthur-LVGameDev

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    228
    It does already check for version updates. It doesn't auto-update anything [there have actually been some Unity [minor!] version updates that force-upgraded a package in the past [ahem, Addressables]), but it does already display [for Unity packages] the version history, including whether or not there are any updates available + a button to upgrade any given package.

    At the very least, give us a button on Git -located packages that says "Check for update" -- when clicked, if it finds an update then: have it display an "Update" button, else show "Up to date" -- exactly the way existing Unity plugins do, just with the first 'version check' (web request) requiring user-action. This would require exactly zero extra requests -- unless the user *specifically* asked for a version-check/check-for-updates.

    Bonus would be: store a boolean in the manifest for "Automatically check for updates?" and have a checkbox on git-sourced plugins so each user can decide, per project, if they want that request to happen for them automatically alongside the Unity plugin update checks, or not. That's pretty much "the gold standard" pattern for most all software these days: opt-in auto-checking for updates, with the perform-update action only occurring upon explicit user-request/user-action. I don't think it's asking for a lot...

    FWIW, if you have any [of your own] packages right now, that you maintain (ie we have some cross-game libraries we use & maintain for several of our games), the only way to update them is to re-add the package via the git URL. There's no UI to do it; you have to write your own [admittedly simple] UI to run the update [via re-adding in code]. If you even semi-commonly tweak your plugin/library or add things to it, that 6-click+copy/paste gets old really fast.

    The package manager is intended to, well, manage packages -- IMO one of the most important parts of managing packages is updating them (really that's probably the main piece of it, perhaps second only to dependency resolution/management)!

    It's pretty much what I'd call "standard expected functionality" from a utility that's intended to simplify the management of packages. Currently though, it's almost [but not quite, lol] as frustrating as git submodules! =D
     
    CrowbarSka likes this.
  24. No, it doesn't. Not for me. And that's good.
    https://forum.unity.com/threads/custom-package-not-updating.696226/#post-7645819 I just hit the "Update" button, which is always there and it updates the Git package. And yes, in 2020 you only can update a git package if you remove and re-add or (if I remember correctly, it was a long time ago) just re-add the git URL.
    But from 2021 it's not true. You have the manual Update button, you just click it and if there is a newer version on the installed path, it downloads it and installs it. But it doesn't tell you if there is a new one. I use this button "a lot" (relatively).
    I'm with you, completely agree. But we already have that.
     
  25. Arthur-LVGameDev

    Arthur-LVGameDev

    Joined:
    Mar 14, 2016
    Posts:
    228
    Ah, I was totally unaware they added the 'Update' button for git -sourced packages in the 2021.x editor versions. That's better than what it was before, so I'm semi-satisfied!

    I'd still like the ability to check for updates (and ideally opt-in auto-check), but I'll take what I can get.

    The Unity -sourced packages definitely do "check" for updates(or at least did previously, maybe that's changed too, though the screenshot implies otherwise). I believe that occurs via a single request though, and happens as part of the initial "get packages list" request. I assume the returned data simply includes at least some version data.

    This can be gleaned just from the UI alone, actually the screenshot you referenced shows it -- some of the packages in that screenshot have a "Up" arrow next to them [in the left-side listing of packages, right-side of the package title/heading] -- that arrow means that the package has an update available. Which means the package manager "checked" for an update; most likely it simply compared the version number in the local manifest file vs the refreshed [unity / server-fetched] data's version number for that package, and found they differed...
     
  26. They do, but they do at once for all Unity packages, it's essentially one query and get back an array.
    It is impossible to check all git-sourced package's update at once. It needs to be one by one. It means exactly the number of call as many git package you have. To various URLs and services (not every package is on GitHub). For example half of my custom packages are on GitHub, the other half are on Azure DevOps Repos. This is why I think it would be a bad idea the automatic "download the package.json to find out the latest version number for each package without asking first". Again, as a feature sure, with the option to turn it off and off by default, cool with me.
     
    Arthur-LVGameDev likes this.
  27. makled

    makled

    Joined:
    May 28, 2017
    Posts:
    14
    This is really a pain, and it defeats the purpose of creating custom packages. The main idea for having a git repo in the first place is to keep your projects updated. Further, removing the package entry from the lock file only breaks the project for some reason.

    Any news on this?
     
    TwoBitMachines likes this.