이 섹션에서는 패키지 관리자에 대해 다음을 설정하는 방법에 대한 정보를 제공합니다.
In addition, you can find the location of the Package Manager configuration files under Configuration files.
By default, the Package Manager uses this folder structure for its caches:
<global-cache-root>
├── npm
│ └── <registry data (package metadata and tarballs)>
├── packages
│ └── <uncompressed contents of package tarballs>
└── git-lfs (if enabled)
└── <downloaded Git LFS files>
To override the default location of the Package Manager’s global cache root, you can use either the cacheRoot
property in the user configuration file or set the UPM_CACHE_ROOT
environment variable.
Note: Consider using the configuration file strategy for macOS and Linux systems, because it can be hard to launch Unity with environment variables if you’re not on Windows.
You can also set environment variables to override the registry data cache, the uncompressed packages cache, or the Git LFS cache. However, environment values and configuration file properties are not equivalent, so using different methods to configure settings can produce unexpected results.
There are many factors affecting how the levels and setting methods work together:
UPM_CACHE_ROOT
environment variable and the cacheRoot
property, Package Manager uses the location in the UPM_CACHE_ROOT
environment variable.UPM_NPM_CACHE_PATH
), the uncompressed packages cache (UPM_CACHE_PATH
), or the Git LFS cache (UPM_GIT_LFS_CACHE_PATH
), Package Manager uses the new location, regardless of where the global cache root is.UPM_ENABLE_GIT_LFS_CACHE
) without explicitly setting its path (UPM_GIT_LFS_CACHE_PATH
), Package Manager uses the git-lfs
folder under the global cache root as its location.Follow these instructions to override the location of the global cache root:
Locate the .upmconfig.toml
user configuration file. If the file doesn’t exist, create an empty text file.
Set the cacheRoot
property to a custom location with an absolute path. For example:
cacheRoot = "/dev/external/shared/Unity/cache"
You don’t need to restart the Unity Editor or the Hub after updating the cacheRoot
property for them to take effect.
You can use environment variables to configure several settings for the Package Manager. However, in order for these settings to apply, you have to launch Unity or the Hub from a terminal or command prompt where those environment variables have been defined and exported every time.
For example, you can run these commands in a macOS or Linux terminal to override the registry data cache and enable the Git LFS cache:
# On macOS/Linux:
export UPM_NPM_CACHE_PATH=/dev/ssd/shared/Unity/cache/npm
export UPM_ENABLE_GIT_LFS_CACHE=true
echo "Launching Unity with the Git LFS cache enabled and using this global cache location: '$UPM_CACHE_ROOT'"
"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"
This Windows example configures both the global cache root and the Git LFS cache:
# On Windows:
@echo off
set UPM_CACHE_ROOT=%ALLUSERSPROFILE%\Unity\config
echo "Launching Unity with this global cache location: '%UPM_CACHE_ROOT%'"
"C:\Program Files\Unity Hub\Unity Hub.exe"
You can use the UPM_CACHE_ROOT
environment variable to override the location of the global cache (the root folder containing the registry data and uncompressed packages caches).
The following environment variables are available:
Environment variable: | 설명: |
---|---|
UPM_NPM_CACHE_PATH |
Specify the absolute path to the location where you want Package Manager to store package metadata and tarballs. By default, this is the npm subfolder under the global cache root. |
UPM_CACHE_PATH |
Specify the absolute path to the location where you want Package Manager to store the uncompressed contents of package tarballs. By default, this is the packages subfolder under the global cache root. |
UPM_GIT_LFS_CACHE_PATH |
Specify the absolute path to the location where you want Package Manager to store the Git LFS cache. By setting this path, you automatically enable the Git LFS cache. |
UPM_ENABLE_GIT_LFS_CACHE |
Specify any value except empty ("" ) to enable the Git LFS cache. Package Manager will use the git-lfs subfolder under the global cache root. |
Package Manager supports two configuration files: a global configuration file and a user configuration file. Both of these files use the TOML format and they appear in different locations:
패키지 관리자는 upmconfig.toml
이라는 이름의 전역 설정 파일을 사용합니다. 이 파일은 다음 위치에서 찾을 수 있습니다.
환경: | 위치: |
---|---|
Windows | %ALLUSERSPROFILE%\Unity\config\upmconfig.toml |
macOS 및 Linux | /etc/upmconfig.toml |
패키지 관리자는 .upmconfig.toml
이라는 이름의 사용자 설정 파일을 사용합니다. 이 파일은 다음 위치에서 찾을 수 있습니다.
환경: | 위치: |
---|---|
Windows (user account) |
%USERPROFILE%\.upmconfig.toml (예: C:\Users\myusername\.upmconfig.toml ) |
Windows (system user account) |
%ALLUSERSPROFILE%\Unity\config\ServiceAccounts\.upmconfig.toml (예: C:\Users\Public\Unity\config\ServiceAccounts\.upmconfig.toml ) |
macOS 및 Linux |
~/.upmconfig.toml (예: /Users/myusername/.upmconfig.toml ) |