如果希望有限数量的用户能够访问包,或者需要在封闭的网络组织中设置包注册表服务器,则您可以设置自己的包注册表服务器。
完成包的开发并希望与其他用户共享时,有多种选择:
Tarball | 可以将包作为 zip 或 tarball 分发给其他的 Unity 用户。这样,他们可以直接从本地 tarball 安装包,也可以将 zip 或 tarball 解压缩到自己计算机上的本地文件夹中,然后从那里安装。 |
Git URL | 可以使用以下支持的协议之一分发指向您的 Git 代码仓库的链接。然后,用户可以使用包的 Git URL 来安装包,因为 Unity Package Manager 可以从 Git 代码仓库(如 GitHub 和 GitLab)提取包。 |
范围注册表 | You can set up a package registry server to host your package and then publish it to that registry using npm’s publish command. Your package’s consumers can then set up a scoped registry configuration in their project to fetch your custom packages from your own package registry. Unity Package Manager supports registries based on the “npm” protocol. You can use any off-the-shelf npm registry server and it should work, but Verdaccio is quick to set up and doesn’t require a lot of configuration. Warning: When you set up your own package registry server, make sure you only use features that are compatible with Unity’s Scoped Registries. For example, Unity doesn’t support namespaces using the @scope notation that npm supports.Most of the time, anonymous access within a local network is sufficient to fulfill your security requirements. However, if you want more control over who accesses packages via scoped registries, you can enable npm authentication for specific users. Your package’s customers can then configure their scoped registries to use their npm authentication tokens. |