Build Tips

intermediate performance

Volumetric 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 LineFeatureDisable If...
FOG_DISTANCE_ONStarting DistanceStarting Distance is always 0
FOG_VOID_SPHERE / FOG_VOID_BOXFog VoidNot using fog void areas
FOG_AREA_SPHERE / FOG_AREA_BOXFog AreasNot using fog area containers
FOG_HAZE_ONSky HazeSky Haze is always 0
FOG_OF_WAR_ONFog of WarNot using fog of war
FOG_POINT_LIGHTSPoint LightsNot using fog point lights
FOG_SCATTERING_ONLight ScatteringNot using god rays
FOG_SURFACETerrain FitNot using terrain fit

Manual Shader Stripping

For maximum control, edit VolumetricFog.shader directly:

  • Feature not needed: remove the entire #pragma multi_compile line and any related #if/#endif blocks.
  • Feature always needed: remove the #pragma line AND remove the #if/#endif guards, 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.

Was this page helpful?