- Home /
Question by
Diggleborf · Sep 26, 2012 at 11:04 PM ·
buttonkeyboardfogingame
Is it possible to link a button on my keyboard to disable fog in-game?
i want to be able to quickly turn off fog without going into the editor menu and leaving the game view. what would i need to type in for code to turn off fog with one key (f) and turn fog back on with another key (g).
Comment
Answer by aldonaletto · Sep 26, 2012 at 11:08 PM
You can control the fog at runtime: just set RenderSettings.fog to true or false to turn fog on or off - like this:
function Update(){
if (Input.GetKeyDown("f")){ // F toggles fog on/off
RenderSettings.fog = !RenderSettings.fog;
}
}