- Home /
Decided to do something else.
How do I call the Global Fog script from StandardAssets/Effects/ImageEffects?
Hi.
Is there a way to call the Global Fog script from UnityStandardAssets to be accessible in my DayNight script? I'm trying to get the nights to appear darker at nighttime and then disable it again when it's daytime.
Surely you would assign it, then enable it/disable it as in any other script.
Answer by AurimasBlazulionis · Sep 16, 2016 at 07:14 AM
Fog can be toggled using RenderSettings.fog
. It is a boolean.
Thank you. There seem to be a bug with that "using" cause a few days ago there wasn't anything that listed "ImageEffects" in $$anonymous$$onoDevelop..
How do I get the GlobalFog exposed in the inspector so I can apply it to the script or is that not needed?
I added using UnityStandardAssets.ImageEffects; and then a variable public ImageEffects globalFog;, but didn't seem to work to be able to use the GlobalFog script.
It seems global fog is not toggleable, but you can disable fog using RenderSettings.fog value,
Good idea. Although, I have an issue with RenderSettings.
The RenderSettings.fogDensity works on daytime but won't update when the night comes.
They are both in an if statement in the Update() function like this:
if (hour >= 180) {
// It's nighttime
time = nightTimeLength;
sun.color = nightTimeColour.Evaluate (time);
RenderSettings.fogDensity = 0.2f;
sun.intensity -= Time.deltaTime;
}
if (hour <= 180) {
// It's daytime
time = dayTimeLength;
sun.color = dayTimeColour.Evaluate (time);
RenderSettings.fogDensity = 0.01f;
sun.intensity += Time.deltaTime;
}
How can I make the RenderSettings update itself?
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Rain particles are getting affected by the fog 2 Answers
Distribute terrain in zones 3 Answers
Initialising List array for use in a custom Editor 1 Answer
What is the best way to assign a duration to particles? 1 Answer