What is a Scoped Package Registry?

Hey, I am reading the manual and was confused as to what a scoped package registry was exactly. Specifically, I am trying to understand this sentence from the manual:

"A scoped registry allows you to use a registry in addition to the Unity default registry where you can host your own packages. Using scoped registries ensures that the Package Manager always maps a package to one and only one registry, guaranteeing a consistent result regardless of network conditions.

For example, if you set up your own server where you are hosting some of the Unity packages, you could end up getting the package from the wrong registry if one registry is temporarily unavailable, even if the Package Manager always searches the registries in the same order. However, if you set up a scoped registry for your own server, the package always maps to one and only one registry, guaranteeing a consistent result regardless of network conditions."

Hey there!

For your question, there’s an thread with an excellent example that should help you understand the concept better. Let me know if you had more questions after giving it a read. :slight_smile:

So just to clarify, a scoped package is just another registry in addition to the default unity registry. The reason you would use a scoped registry is so you can host your own packages. My question is what does it mean to ā€œhostā€ your own packages.

Hi,

To host your own packages means you need to run your own registry server where you can publish and update your packages.

We draw a lot of references from npm and I found an article that explains more into how to run our own npm registry

Could you explain the example above that I posted at the beginning I’m still having a hard time understanding it.

For example, if you set up your own server where you are hosting some of the Unity packages, you could end up getting the package from the wrong registry if one registry is temporarily unavailable, even if the Package Manager always searches the registries in the same order. However, if you set up a scoped registry for your own server, the package always maps to one and only one registry, guaranteeing a consistent result regardless of network conditions.

I’m not exactly sure what it means to have a server hosting unity packages and how that’s different than just having a scoped registry.

I’ll reach out to our technical writer and share your difficulty to understand this part of the manual. I’ll suggest them to update the documentation to make it clearer.

Thank you for your feedback. I’ll keep you posted when the documentation is updated.

1 Like

Hi, I’m sorry you are finding the scoped registry documentation difficult to understand.

In answer to your question, most people or organizations would not host their own version of a Unity package. However, there are rare cases where an organization might need to create a local registry inside a closed network and host their packages from there but still retain the Unity package server as the main registry.

Does that help?

1 Like

So basically a scoped registry is a registry in addition to the default unity registry where you can host your own packages. However not a lot of people would really need to use a scoped registry except organizations that may want to host their own version of a package, without getting it mixed up with the original one from the original registry. Is that correct or no?

I’m not exactly sure what it means to have a server hosting unity packages and how that’s different than just having a scoped registry. Like… what is a server?

In the case of scoped registries, companies/individuals would need to have somewhere to put their custom Unity packages - this is the ā€˜server’. A package server is basically an application that keeps track of packages and is also where packages are stored - i.e. the destination of the scoped package repository URL.

An example of a ā€˜package server’ that Unity has mentioned in some of their documentation is Verdaccio - see their ā€˜What is Verdaccio’ page.

How could you set up your own server and host unity packages on it and what could an example of that be? Does each registry get it’s own server?