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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Manually add custom packages to the list of available packages?

Discussion in 'Package Manager' started by MetalFox, Oct 6, 2022.

  1. MetalFox

    MetalFox

    Joined:
    May 14, 2014
    Posts:
    10
    Hi ! I've been experimenting with UPM and packages hosted on Gitlab, thanks to that thread : https://forum.unity.com/threads/using-github-packages-registry-with-unity-package-manager.861076/
    Everything works well, but, as the thread implies, the biggest problem is the package discovery.

    I'm okay with that, but is there a way to manually add some packages names in the packages list, or to add a custom Package Set? I would love to have a way to display our custom packages inside the editor, even if it's just a static list that I have to provide and maintain ^^'.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,191
    You can give each package a custom title/name in package.json - so what I do is to prefix all my packages with "CodeSmile" and they'll show up next to each other in Package Manager respectively in Project view under Packages.
     
  3. MetalFox

    MetalFox

    Joined:
    May 14, 2014
    Posts:
    10
    But how do you add them to the Package Manager list in the first place ? UPM doesn't seem to be able to automatically fetch the list of packages I have on Gitlab (I guess that's what "package discovery" is ?) ^^'.
    My end goal is to avoid having to type the name of each package I want to add by displaying a list of custom packages I can add to my project.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,191
    You can set up your own package registry, it's described in the Unity manual. Haven't used that though.
     
  5. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    488
    Hi @MetalFox,

    Git hosting services that provide package registries like Github Packages and Gitlab Packages often do not support the npm search endpoints (returning error codes such as HTTP 405 Method Not Allowed or HTTP 403 Forbidden), which means it's not possible for UPM to get the list of packages available on those registries. There is currently no mechanism in place to provide a hard-coded list of package names to include in scoped registry lists, so unfortunately I can't think of a solution for what you're trying to do at this time. Your best bet, as suggested by @CodeSmile, would be to set up your own scoped registry that supports search endpoints, but that can be a rather involved option.

    That's not to say such a feature is without merit, so I'll look into tracking this feature request. Don't hold your breath though, I can't promise we'll be able to implement this anytime soon, if ever.
     
  6. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    161