Build Tips
intermediate performanceVolumetric Fog & Mist (Built-in) · Troubleshooting & FAQ
Build Tips
This page covers techniques to reduce build time, binary size, and runtime overhead when shipping Volumetric Fog & Mist 2 in production builds.
Reduce Shader Keywords
The single most impactful optimization for build time. Open Shader Options at the top of the VolumetricFog Inspector and disable every feature you do not use. Each disabled keyword can significantly reduce shader compilation time.
Keyword Reference
| Pragma Line | Feature | Disable If... |
|---|---|---|
FOG_DISTANCE_ON | Starting Distance | Starting Distance is always 0 |
FOG_VOID_SPHERE / FOG_VOID_BOX | Fog Void | Not using fog void areas |
FOG_AREA_SPHERE / FOG_AREA_BOX | Fog Areas | Not using fog area containers |
FOG_HAZE_ON | Sky Haze | Sky Haze is always 0 |
FOG_OF_WAR_ON | Fog of War | Not using fog of war |
FOG_POINT_LIGHTS | Point Lights | Not using fog point lights |
FOG_SCATTERING_ON | Light Scattering | Not using god rays |
FOG_SURFACE | Terrain Fit | Not using terrain fit |
Manual Shader Stripping
For maximum control, edit VolumetricFog.shader directly:
- Feature not needed: remove the entire
#pragma multi_compileline and any related#if/#endifblocks. - Feature always needed: remove the
#pragmaline AND remove the#if/#endifguards, leaving the code always active. This eliminates the keyword variant without losing the feature.
Remove Demo Content
Delete or exclude the Demo folder when importing into production projects. Demo scenes, scripts and assets are not required by the asset.
Strict Shader Variant Matching
If you encounter shader errors in builds that do not occur in the Editor, disable Strict Shader Variant Matching in Player Settings > Configuration.
Project-Level Optimization
For project-wide shader keyword management across all assets, consider using Shader Control to audit and strip unused variants.
Suggest an improvement
Help us improve this documentation page.