The type or namespace name `GlobalFog' could not be found.

Hey guys,

I know that there are tons of threads about this error, but they all provide the solution to make the GlobalFog script public. I did that but get the error anyway. Anything you could imagine is worth trying? Is this maybe a bug?

Thats my script line:

    public class GlobalFog : PostEffectsBase

Woah, okay I think I got what you are trying to do, sorry I am the one that missunderstood I think. Not sure I would recommend altering any unity assets as each update you apply might undo all of your work but…

I would highly recommend that you CopyPasta the class and rename the “GlobalFog” method to avoid coflicts to something like “MyGlobalFog”.

Anyways… you just need to pay attention to the namespaces for a little help. The “GlobalFog” is inside of the “UnityStandardAssets.ImageEffects” namespace. So in order to access it after making it public you need to reference that namespace using one of the two methods below.

The usual method for sporting ease would be to add a using…

using UnityStandardAssets.ImageEffects;

The Savants method would be to address the entire darn thing, changing your line like so.

CameraObj.GetComponent<UnityStandardAssets.ImageEffects.GlobalFog> ().height = 5 / distance;

One of those two ways should pop for you.

Side note, looking at the code the Height variable type is a float, you may need to add a “f” to the end of that 5 or it might toss an error an at unexpected time regardless of which way you want to roll. If you create that “MyGlobalFog” method, remember that you are Adding to the same namespace so expect to see GlobalFog and MyGlobalFog at the same time.