当您在 Package Manager 窗口中工作时,可以安装来自多个来源的包(注册表,本地文件夹或者 tarball 以及 Git URL)。然而,虽然 Package Manager 从这些源无缝安装包,但它首先必须进行一系列计算来决定安装哪个版本,以及安装其他哪些包和版本来支持它。
当您通过 Package Manager 窗口选择要安装的包版本时,请向您的项目清单添加一个__依赖项__。这是一个声明,您需要特定包的特定版本才能使项目正常工作。出现在您的依赖项中项目清单称为“直接”依赖项。
Packages can also require other packages in order to work. These are called “indirect”, or transitive, dependencies. The package developer adds these dependencies to the package’s manifest during development. For example, there are several 2D packages that share functionality: both the 2D Animation and 2D Sprite Shape packages depend on the 2D Common package.
当您将包版本添加为依赖项时,该版本不一定是 Package Manager 安装的版本,因为它必须考虑项目中的所有依赖项,无论是直接的还是间接的。为了决定安装哪些包,Package Manager 构建了一个列表,列出每个直接和间接依赖项。
Package Manager 一次只能安装一个包版本,因此它必须构建一个依赖图以确定要安装每个软件包的哪个版本。当 Package Manager 成功解析所有版本冲突时,它会将解析结果保存在一个锁定文件中以保证确定性(以便每次都可靠地安装相同的包),并节省再次计算依赖图所需的时间和资源。
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.