Version: 2021.1
言語: 日本語
パッケージの状態とライフサイクル
グローバルキャッシュ

依存関係と競合の解決

Package Manager ウィンドウで作業するとき、複数のソース (レジストリ、ローカル フォルダー.tgz ファイルGit URL) からパッケージをインストールすることができます。しかし、Package Manager は、これらのソースからパッケージをシームレスにインストールします。ただし、Package Manager は、これらのソースからパッケージをシームレスにインストールしますが、最初に一連の計算を行って、どのバージョンをインストールするか、また、それをサポートするのにインストールが必要な他のパッケージやバージョンを決定する必要があります。

Package Manager ウィンドウでインストールするパッケージのバージョンを選択すると、 依存関係プロジェクトマニフェスト に加えることになります。これは、プロジェクトを動かすために、特定のパッケージの特定のバージョンが必要であるという宣言です。プロジェクトマニフェスト に示される依存関係は、“直接” 依存関係と呼ばれます。

パッケージは、機能するために他のパッケージを必要とすることがあります。これは “間接的” または “推移的” な依存関係と呼ばれます。パッケージの開発者は、開発中にこれらの依存関係を パッケージマニフェスト に加えます。例えば、以下の図では、alembic@1.0.7 パッケージは、timeline@1.0.0 パッケージに依存しています。つまり、timeline パッケージは “間接的” 依存関係にあります。一方で、プロジェクトは、cinemachine@2.6.0alembic@1.0.7 に依存しています。つまり、これらは両方とも “直接的” 依存関係です。

直接的な依存関係と間接的な依存関係を示す図。

When you add a package version as a dependency, that version is not necessarily the version that the Package Manager installs, because it has to consider all of the dependencies in your project, whether direct or indirect. For example, in this case, the Settings Manager package requested was version 1.0.1, but the installed version is actually version 1.0.3 because another package depended on the higher version, as indicated in the information message (A):

When you click the information button in the details pane (B), a text box appears (A) explaining why this version was installed instead of the one you requested
When you click the information button in the details pane (B), a text box appears (A) explaining why this version was installed instead of the one you requested

The Package Manager can only install one package version at a time, so it has to construct a dependency graph, which is a list of every direct and indirect dependency for the project. The dependency graph determines which version of each package to install.

When the Package Manager successfully resolves all version conflicts, it saves the resolution in a lock file to ensure determinism (so that the same packages are reliably installed every time), and to reduce the amount of time and resources it takes to compute the dependency graph again.


パッケージの状態とライフサイクル
グローバルキャッシュ
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961