Search Unity

Simple camera effects don't work in the game build

Discussion in 'Getting Started' started by DEV971, Oct 2, 2018.

  1. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    Code (CSharp):
    1.    
    2. void OnTriggerEnter(Collider collider)
    3.     {
    4.         cam.backgroundColor = new Color(0, 0.4f, 0.7f, 1);
    5.         RenderSettings.fog = true;
    6.         RenderSettings.fogColor = new Color(0, 0.4f, 0.7f, 0.6f);
    7.         RenderSettings.fogDensity = 0.05f;
    8.     }
    9.  
    This is my rough attempt to create an underwater effect.
    Despite the fact it doesn't look realistic I can clearly see it when I play the scene from the editor.
    However when I build the game it's just like if that code doesn't exists, I can see in the console that the event triggers and I can play sounds there but these effects are not displaying.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,375
unityunity