[DRAFT] Global Illumination UVs
Light troubleshooting and performance

GICache

The GI Cache is used by the Global Illumination system to store intermediate files when precomputing realtime GI, baking static lightmaps, light probes and reflection probes. The cache is shared between all Unity Projects on the computer, so Projects with the same content and same Enlighten version can share some of the files and speed up subsequent builds.

You can find the settings for the GI Cache in Edit > Preferences > GI Cache on Windows and Unity > Preferences > GI Cache on Mac OS X. Here you can set the maximum cache size, clear out the currently cached files, as well as set a custom cache location.

If nothing in the scene has changed then lighting data should load from the cache in a very short amount of time when reloading your scene if you have Auto mode enabled in the Lighting window.

When the cache size grows larger than the size specified in preferences, Unity spawns a job to trim the least recently used files. If all the files in the cache are in use by the current scene, because the scene is very large or the cache size is set too low, you need to increase your cache size in the preferences or you will see a lot of recomputation when baking.

It is not safe to delete the GI Cache directory yourself while the Editor is running, use the button in the Preferences window. The GI Cache folder is created on Editor startup and the Editor maintains a collection of hashes that is used to look up the files in the GI Cache folder. If a file or directory suddenly disappears, the system can’t always recover from the failure and will print an error in the Console. Please use the button in Preferences > GI Cache > Clean Cache for clearing the cache directory, as this will ensure that the Editor releases all references to the files on disk before they are deleted.

Having the GI Cache on an SSD drive can speed up baking in cases where the baking process is I/O bound.

In the Lighting window, the bake button can expand into a dropdown that lets you clear the baked data in the scene if you are in non-Auto baking mode. This will not clear the GI Cache as that would be counterproductive and increase bake time afterwards.

It is possible to share the GI Cache folder among different machines, this can make lighting build faster because the files can be downloaded from the cache instead of computed from scratch locally. Beware that the build process isn’t optimized for slow network attached storage, so test if your bake times are severely affected before moving the cache to a NAS.

The files in the cache are LZ4 compressed by default and the naming scheme is a hash and a file extension. The hashes are computed based on the inputs to the lighting system, so changing any of the following can lead to recomputation of lighting:

  • Materials (textures, albedo, emission)

  • Lights

  • Geometry

  • Static flags

  • Light probe groups

  • Reflection probes

  • Lightmap Parameters

[DRAFT] Global Illumination UVs
Light troubleshooting and performance