How to reproduce:
1. Open the attached “IN-109289” project
2. Go to Edit → Preferences → GI Cache
3. Set the Maximum Cache Size to 5 GB and set a custom empty folder location for the cache
4. Close the project and reopen it with these command-line arguments: “-batchmode -executeMethod LightingManager.BakeSceneLighting”
5. Open the Task Manager and search for the Unity Editor
6. Wait until the Unity editor dissappears and the Lighting baking is done
7. Right click the selected custom cache folder and select Properties to make sure the folder size is above 5 GB
8. Run the project again with command-line arguments “-batchmode -executeMethod LightingManager.BakeSceneLightingOtherScene”
9. Right click the selected custom cache folder and select Properties to observe the folder size
Expected result: The GI Cache will be cleaned when attempting a new bake because the 5 GB limit is exceeded
Actual result: The GI Cache keeps growing after the second bake
Reproducible with: 2022.3.64f1, 6000.0.54f1, 6000.1.13f1, 6000.2.0b11, 6000.3.0a3
Reproduced on: Windows 11
Not reproduced on: No other environment tested