Package Manager (パッケージマネージャー) はレジストリデータと非圧縮パッケージのためにグローバルキャッシュを維持します。グローバルキャッシュには補助キャッシュが含まれ、それぞれに異なる役割を果たします。パッケージマネージャーはグローバルキャッシュをデフォルトの場所に保存します。デフォルトをオーバーライドすることができます。
キャッシュの場所をオーバーライドしたい理由はいくつか考えられます。
デフォルトでは、Package Manager はキャッシュに以下のフォルダー構造を使用します。
<global-cache-root>
├── npm
│ └── <registry data (package metadata and tarballs)>
├── packages
│ └── <uncompressed contents of package tarballs>
└── git-lfs (if enabled)
└── <downloaded Git LFS files>
For information on the default location of the global cache root, see global cache.
Note: The Package Manager maintains separate caches for the global cache and the Asset Store package cache. For information on overriding the default location for the Asset Store cache, see Customize the Asset Store cache location.
グローバルキャッシュのルートのデフォルトの場所をオーバーライドするには、以下の方法を使用します。
cacheRoot
property in a user configuration file. If you want to set the configuration file manually, see Using a configuration file.UPM_CACHE_ROOT
環境変数と cacheRoot
プロパティの両方でグローバルキャッシュルートに異なる値を設定する場合、Package Manager は UPM_CACHE_ROOT
環境変数の場所を使用します。UPM_NPM_CACHE_PATH
)、非圧縮パッケージキャッシュ (UPM_CACHE_PATH
)、または Git LFS キャッシュ (UPM_GIT_LFS_CACHE_PATH
) に環境変数を設定する場合、Package Manager は、グローバルキャッシュルートがどこにあるかにかかわらず、環境変数に指定された場所を使用します。UPM_GIT_LFS_CACHE_PATH
) を明示的に設定せずに Git LFS キャッシュ (UPM_ENABLE_GIT_LFS_CACHE
) を有効にすると、Package Manager は、グローバルキャッシュルートの下にある git-lfs
フォルダーをその場所として使用します。To use the Preferences window to override the default location of the global cache, follow these steps.
以下のいずれかの方法で Preferences ウィンドウを開きます。
Package Manager カテゴリを選択します。
Packages の下にある Cache Location の横にあるメニューを開きます。
Change Location を選択します。
グローバルキャッシュの新しい場所を選択します。
You can manually edit the same configuration file that the Preferences window sets to override the location of the global cache root:
Locate the .upmconfig.toml
user configuration file. To find the file location, see Configuration files. If the file doesn’t exist, create an empty text file.
cacheRoot
キーを加え、その値をカスタムロケーションへの絶対パスに設定します。 重要: TOML ファイルで Windows のパスを設定するときは、フォワードスラッシュ (/
) またはダブルバックスラッシュ (\\
) を使用してください。シングルバックスラッシュ (\
) は、エスケープシーケンスを示す特殊文字であり TOML 解析エラーの原因となるため、使用しないでください。
Windows の例
cacheRoot = "E:\\Unity\\cache"
macOS と Linux の例
cacheRoot = "/dev/external/shared/Unity/cache"
cacheRoot
プロパティを設定した後に、それを有効にするために Unity エディターや Hub を再起動する必要はありません。
In scenarios that involve automation or continuous integration, it’s less practical and more error prone to configure settings in a configuration file or a preferences window. In such scenarios, you might consider using environment variables to configure settings for the global cache and its subsidiary caches. The following environment variables are available:
環境変数 | 説明 |
---|---|
UPM_CACHE_ROOT |
グローバルキャッシュ の場所を指定します (レジストリデータと圧縮されていないパッケージキャッシュを含むルートフォルダー)。 |
UPM_NPM_CACHE_PATH |
Package Manager がパッケージのメタデータと .tgz ファイルを保存する場所への絶対パスを指定します。デフォルトでは、グローバルキャッシュルートの下にある npm サブディレクトリです。 |
UPM_CACHE_PATH |
Package Manager がパッケージ .tgz ファイルの圧縮されていないコンテンツを保存する場所の絶対パスを指定します。デフォルトでは、グローバルキャッシュルートの下にある packages サブディレクトリです。 |
UPM_ENABLE_GIT_LFS_CACHE |
Git LFS キャッシュを有効にするには、空 ("") 以外の任意の値を指定します。デフォルトでは、Package Manager は、UPM_GIT_LFS_CACHE_PATH 環境変数を使用して別のパスを指定しない限り、グローバルキャッシュルート下の git-lfs サブディレクトリを使用します。 |
UPM_GIT_LFS_CACHE_PATH |
Package Manager が Git LFS キャッシュ を保存する場所の絶対パスを指定します。このパスを設定することにより、自動的に Git LFS キャッシュは有効になります。 |
重要: この方法を用いる場合は、以下のガイドラインに従ってください。
環境変数の設定については、使用しているオペレーティングシステムのドキュメントを参照してください。環境変数に関する情報は、https://en.wikipedia.org/wiki/Environment\_variable を参照してください。
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.