Clean Unity’s cache files on drive C

Under Windows systems, Unity saves global cache files in the system disk by default, occupying a large amount of hard disk space.

There are three situations that take up a lot of space:

1. Various packages downloaded by unity package manager. The default cache directory is C:\Users\{Username}\AppData\Local\Unity\cache

2. Plug-in downloaded from unity asset store. The default cache directory is C:\Users\{Username}\AppData\Roaming\Unity\Asset Store-5.x

3. Unity GI cache. The default cache directory is C:\Users\{Username}\AppData\LocalLow\Unity\Caches

Open Unity Edit->Preferences->GI Cache to modify the custom location.

Unity Manual-Global Cache:https://docs.unity3d.com/cn/2021.2/Manual/upm-cache.html
Modify npm and packages directories

Package Manager uses two different shared caches, each serving a different purpose. They are stored in subdirectories under the above folder location:

As projects grow, our cache will grow larger and larger, causing our default cache location to run out of space. In order to avoid this situation, you need to modify Unity's cache location.

①Find My Computer, right-click and find the properties option

②Open advanced system settings

③Open environment variables

④Customize shared cache location

Either global cache folder can be overridden using two environment variables:

⑤Create 2 new environment variables in the system variables

Variable name 1: UPM_CACHE_PATH
Variable value 1: New cache folder address
Variable name 2: UPM_NPM_CACHE_PATH
Variable value 2: New cache folder address

⑥Restart the computer.
⑦Open UnityHub and Unity project, check whether there is anything cached in the new cache directory, and if so, delete the default cache folder. If not, repeat the above steps.
2. Modify the default download path of Unity Asset Store
1. For files downloaded from the Unity Mall, the default storage path is C:\Users\username\AppData\Roaming\Unity\Asset Store-5.x

AppData files are hidden files and need to be manually set to show hidden files.

2. After finding the Asset Store-5.x folder, cut and paste the entire file to the directory you want to store it.
3. Then enter cmd and enter the command:
mklink /j "C:\Users\Administrator\AppData\Roaming\Unity\Asset Store-5.x" "F:\Unity Asset Store\Asset Store-5.x"

Create a directory soft link.

Reference from:Modify the default paths of Unity Cache and Unity Asset Store - Jianshu (jianshu.com)

Clean Unity’s cache files on drive C - Alan’s website (horse7.cn)

Guess you like

Origin blog.csdn.net/weixin_42301988/article/details/133345182