本节介绍有关 Unity Package Manager 功能的许多概念:
每个包都有多个版本,标记了该包在自身的生命周期中所经历的更改。每次开发人员更新包时,都会为该包提供一个新的版本号。包版本的更改会告诉您这次更改包含了重大更改(主要)、新的向后兼容功能(次要)还是仅错误修复(补丁),并遵循语义版本控制。
要查看特定包可用的版本列表,请参阅查找特定版本。
清单文件有两种类型:
manifest.json
)。项目清单存储 Package Manager 在查找和加载正确的包时所需的信息,并列出声明为依赖项的包和版本。package.json
)。包清单存储有关特定包的信息,并列出该包所需的包和版本。这两种文件都使用 JSON(JavaScript 对象表示法)语法。
Unity maintains a central registry of official packages that are available for distribution. A package registry stores package contents and information (metadata) on each package version. By default, all Projects use the official Unity package registry, but you can add additional registries to store and distribute private packages or stage packages in development.
Unity Package Manager 是管理整个包系统的工具。此工具的主要任务包括:
The Unity Package Manager installs samples, tools, and Assets on a per-Project basis, rather than installing them across all Projects for a specific machine or device. It uses a read-only global cache to store downloaded package metadata and contents. Once installed, Unity treats package Assets just like any other Asset in the Project, except that these Assets are immutable (read-only). You can only change Assets from Local and Embedded package sources.
States indicate where the package is in the development cycle:
The Package Manager window displays a tag that corresponds to some of these states. For more information, see Tags.
来源描述了包的来源:
来源 | 描述 |
---|---|
注册表 | The Unity Package Manager downloads most packages from a package registry into a global cache on your computer as you request them. These packages are immutable (read only), so you can use them in your Project, but you cannot modify them or change their package manifests. |
内置 | These packages allow you to enable or disable Unity features (for example, Terrain Physics, Animation, etc.). They are immutable (read only). |
嵌入式 | Any package stored inside your Project folder is embedded. This source corresponds with the in development state because you typically put all the scripts, libraries, samples, and other Assets your new package needs in a folder under your Project folder when you begin development on a package. |
本地 | 可从计算机上的任何文件夹中安装安装包(例如,如果在本地克隆了开发代码仓库)。 |
Git | Package Manager 直接从 Git 代码仓库安装 Git 包,而不是从注册表服务器进行安装。 |
要编辑包的包清单,请参阅检查包。
Package Manager 窗口会显示与上述某些来源对应的标签。有关更多信息,请参阅标签。