1. Problem description
In the Unity editor, you can turn fog effects on and off by doing the following.
Menu bar Window –> Lighting –> Settings,
After opening the Lighting panel, choose Scene –> Other Settings –> Fog.
To turn Fog off/on, untick the Fog box.
But in many cases, we want code to dynamically turn fog on and off in scripts.
2. Solutions
Enable fog effect
RenderSettings.fog = true;
Copy the code
— Turn off fog effect
RenderSettings.fog = false
Copy the code