Search Unity

Bug Fog working in editor but not in build

Discussion in 'Editor & General Support' started by uzisho, May 26, 2023.

  1. uzisho

    uzisho

    Joined:
    Jul 3, 2019
    Posts:
    14
    3 days of trying to debug this :(

    2021.3 URP.
    Fog is working in the editor but is not working in a build.
    If the scene is being reloaded in the build - the fog appears... :eek:

    What I tried:
    1. Toggling fog off and on using a toggle (nothing happens)
    2. Preloading all shader variants for the fog
    3. Graphic Settings > Changing fog mode to manual

    Anyone ever experienced that?

    Thx!
     
  2. uzisho

    uzisho

    Joined:
    Jul 3, 2019
    Posts:
    14
    Ok - solved it...

    To anyone who deals with that... in my case it was loading another scene on Awake which applied the light settings of that other Scene.
     
    Kurt-Dekker likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    Thank you for coming back to post your postmortem update!

    This also gets into what is the current active scene, which is the one used for lighting, which of course in turn also controls fog.

    Here's more related ramblings about multiple scene setups:

    Additive scene loading is one possible solution:

    https://forum.unity.com/threads/right-way-for-performance-divide-scene.1023673/#post-6630961
    https://forum.unity.com/threads/right-way-for-performance-divide-scene.1023673/#post-6754330

    https://forum.unity.com/threads/problem-with-canvas-ui-prefabs.1039075/#post-6726169

    A multi-scene loader thingy:

    https://pastebin.com/Vecczt5Q

    My typical Scene Loader:

    https://gist.github.com/kurtdekker/862da3bc22ee13aff61a7606ece6fdd3

    Other notes on additive scene loading:

    https://forum.unity.com/threads/removing-duplicates-on-load-scene.956568/#post-6233406

    Timing of scene loading:

    https://forum.unity.com/threads/fun...ject-in-the-second-scene.993141/#post-6449718

    Also, if something exists only in one scene, DO NOT MAKE A PREFAB out of it. It's a waste of time and needlessly splits your work between two files, the prefab and the scene, leading to many possible errors and edge cases.

    Two similar examples of checking if everything is ready to go:

    https://forum.unity.com/threads/daily-events-and-content-changes.1108202/#post-7143713

    https://forum.unity.com/threads/uni...on-before-other-scripts.1153739/#post-7401794