如果希望有限数量的用户能够访问包,或者需要在封闭的网络组织中设置包注册表服务器,则您可以设置自己的包注册表服务器。
完成包的开发并希望与其他用户共享时,有多种选择:
Tarball | 可以将包作为 zip 或 tarball 分发给其他的 Unity 用户。这样,他们可以直接从本地 tarball 安装包,也可以将 zip 或 tarball 解压缩到自己计算机上的本地文件夹中,然后从那里安装。 |
Git URL | 可以使用以下支持的协议之一分发指向您的 Git 代码仓库的链接。然后,用户可以使用包的 Git URL 来安装包,因为 Unity Package Manager 可以从 Git 代码仓库(如 GitHub 和 GitLab)提取包。 |
范围注册表 | 可以设置一个包注册表服务器来托管包,然后使用 npm 的 publish 命令将包发布到这个注册表中。然后包的消费者可以在其项目中设置范围注册表配置,以从您自己的包注册表中获取您的自定义包。 Unity Package Manager 支持基于“npm”协议的注册表。确保您选择的注册表服务器实现 /-/v1/search 或 /-/all 终端。警告:设置自己的包注册表服务器时,请确保只使用与 Unity 的 Scoped Registries 兼容的功能。例如,Unity 不支持 npm 支持的使用 @scope 表示法的命名空间。大多数情况下,本地网络内的匿名访问足以满足您的安全要求。但是,如果想通过范围注册表更好地控制哪些人可以访问包,可以对特定用户启用 npm 身份验证。这样,包的客户可以配置其范围注册表,从而使用其 npm 身份验证令牌。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.