Me and my team are using the custom registry feature of package manager, and it’s been working really well for us. We have authentication working well, and even have a little “installer” that runs inside of unity that someone can run in order to set up authentication for a project. We are running into one little bootstrapping issue here. Consider the following events:
Person A creates a project, set up with authentication and multiple packages.
Person A stores this project onto a repository.
Person B clones the project onto their local machine.
Person B doesn’t yet have authentication, and so the project gives compile errors since it cannot resolve the requested packages that have been used.
Person B cannot run the custom “Installer” due to these compile errors.
So far we have been getting around this issue by having person B use the installer on an empty project, which sets up the computer-wide authentication, which then works for the cloned project. But it would be really nice if the project itself could take you through the custom auth flow without giving you a bunch of noisy “cannot authorize host” errors. But in order to do that, we would need to somehow manage to run code inside of a project that has compile errors, which seems impossible.
We plan on improving the UX around custom registry authentication, but not in the near future.
In the meantime, I can suggest workarounds that may simplify your life a bit:
You could try moving the “authentication” part of your Installer code to a script instead of C# code. Users could then simply run it by double-clicking it, prior to opening the project.
You could try compiling your “Installer” code into a DLL, and include that DLL instead on the project. You can trigger code on Launch by following the steps described here: https://docs.unity3d.com/Manual/RunningEditorCodeOnLaunch.html. There’s a caveat though (it might not apply to newer versions of the Editor): this code may fail to run the first time the project is opened, because the DLL is not yet registered with the Asset Database, so you will still have errors. However, the DLL will have been imported, so on second project open, the code should run.
Hopefully either of these workarounds will improve your team’s quality of life somewhat until we can make npm authentication a bit more first-class citizen. Thank you for your patience and understanding!