I’m wondering if there’s anything I’ve missed that would get this working. If it is not possible, as the errors would suggest, to have custom dependencies in a package.json file, will this be supported in future?
For security and stability reasons, this is currently not supported, by design. I can’t say whether or not this feature will be supported in the future for custom packages, but I expect that no published package hosted by Unity will ever be allowed this since it essentially side-steps any kind of validation/verification of the package.
What you can do, however, is use a scoped registry (a.k.a. private registry) to publish your custom packages on a registry you control. (See https://discussions.unity.com/t/719331 for more information on how to set this up.)
Also note that while the packages are embedded in your project or declared as a dependency in your project manifest, they override any package of the same name found as a package dependency during dependency resolution. So, barring the use of a scoped registry, your above setup would work if you explicitly added the Dependency package in your project manifest using a Git URL, and updated your Depender package.json so it did not declare a dependency on the Dependency package or declared it with a version (that would be ignored in favor of the project dependency on Dependency).
I might be mistaken, but it seems like Oloin is referring more to a package hosted on his own git repository versus one hosted by Unity. I am also looking at this for splitting up an open source project hosted on github into several smaller packages with one core and the others as optional secondaries requiring core.
It seems implied that something like this might work based on what forum threads/documentation I’ve found, but now requires a user to list all dependencies of a package independently in the manifest.json file and won’t account for sub-dependencies (two levels deep dependencies or more).
This is seriously annoyingly nonsense. The usable of package manager is to let us able to share any package with any dependency package and the manager will resolve all dependency automatically. If you don’t let us upload all of our package on your server directly then it limit the usability of the manager. We must uselessly include all of our sub package in our own package or else we cannot share it
If we only develop individually or internally then we don’t really need package manager at all. The point is to share the package as a submodule to anyone and anywhere. Scope registry is totally useless and waste of time on your side. We only need git dependency and custom dependency. I really want to ask who was think about this idea and waste all your time? Have you even think about the use case scenario before add this feature?
We just need a custom dependency. Not a useless workaround like scoped registry unless the scope registry could be resolved from dependency. If we tell people that “you can add our package into package manager” but then “oh but you also need to add this line in this file and these lines in this file and this line in these files” then it become totally pointless to have package manager
I’m sorry to hear that the Package Manager does not exactly fit your requirements.
We are still working on putting the required infrastructure, tooling, and publishing flows to enable external contributions to the Package Manager registry. That is why I mentioned setting up a private registry would be the first step in sharing custom packages.
Setting up your own registry (for instance Verdaccio - https://github.com/verdaccio/verdaccio) is actually pretty simple. It’s installed using npm, and run using a single command-line. Configuring the Package Manager to use that scoped registry is also not too complicated - an action you need to do once per project so the Package Manager knows where to look in addition to the main registry (see https://docs.unity3d.com/Manual/upm-scoped.html) when it resolves the project’s dependencies.
For example, you could add the following to a project manifest:
@maximeb_unity That’s the point that I would call it pointless
The point is, this feature is Package Manager. It was named as “Package Manager” and you can see that every popular package manager, be it NPM or NuGet, has an ability to resolve all of it dependency as first priority. Because if the package can resolve dependency in one machine but failed to resolved in another machine without tweaking configuration, That package would become useless, and also the manager itself would be a totally useless manager
And to config each and every machine just to use one package is defeating the purpose of using package manager itself. So if any feature want to have be named Package Manager it should have a way to resolve dependency of any depth from the package itself without having people go manage each dependency when they just want to include another package
People try to include package in their project for their convenience. But you are making this useless package manager that force people to do inconvenience things it defeat the purpose of using Package Manager immediately
an action I need to do once per project is not acceptable for the feature named Package Manager. It must be an action I need to do once per package. It must be an action that, when I tell some people to include my package. They only really need to just include my package and done, the manager will do everything on its own to resolve every bits of dependency into that person’s project, any number of person and any number of project, to have each person need to tweak each project they create just to use my package it a uselessly annoyingly inconvenience loss cost
Because the usability of the feature named Package Manager is that, I am not the one who use it. There would be many people to use it by installing my package into their project
This is why I want to ask that, have you ever think about the use case scenario of this feature? Have you ever think about the actual use case scenario of feature named Package Manager ? Who have suggest you to try doing that useless scope registry feature before custom dependency? You trying to present scope registry is telling me that you are all half heartedly in designing the feature named Package Manager. You don’t understand the use case of Package Manager at all. Unless the scope registry can be resolved from the package. Which I have trying and it was not
If you making feature named Package Manager you then must have thought about this. If not you should just name it Unity Registry Package Installer UI not a Package Manager or else it will become a false advertisement
Yes, indeed, the current implementation has limitations associated with GitHub. Now I am working on the development of the whole ecosystem for working with packages regardless of their location, I plan to finish by the end of the month.
I’m not sure what the plans regarding open sourcing it. At this time it’s not possible but I will pass the suggestion along. Thank you for your continued interest!
can a custom package in scoped registry depend on another package that is in an other scoped registry? We have ar tools in our own registry which depend on the vuforia package, which is in their own scoped registry.
Can I somehow define in the package manifest that the vuforia package is to come from another scoped registry, or would I have to define vuforias registry in the importing projects manifest?
Unity 2020**.1** is beta. Maxime only said it’s on the roadmap for 2020, not if it’ll land in 2020.1, 2020.2 or 2020.3 (or at all – being on the roadmap is no guarantee).
I wouldn’t hold my breath waiting for it and look for alternatives in the meantime.