Search Unity

Question Use Lighting Data Asset in different scene with rebaking? (Change to non-directional)

Discussion in 'Global Illumination' started by GoinPlaces, May 25, 2023.

  1. GoinPlaces

    GoinPlaces

    Joined:
    Nov 15, 2017
    Posts:
    13
    Hello!

    I was wondering why it's not possible to do that.
    When you choose a different LightingDataAsset in the Baked Lightmaps Tab it seemingly works, but it doesn't actually get saved into the scene (when I save and reload it's still the one it was baked with)

    Do I have to rebake every time when I want a Lighting Data Asset to be assigned?

    TL;DR: Our main issue is that we have scenes which be want to use in a Windows/MacOS build as well as WebGL build, but with directional mode/maps for the Win/Mac builds and non-directional for WebGL. Is there a way to do that?

    (without duplicating the scenes and having to bake EVERY. TIME.)

    As a kind of crappy emergency workaround I thought we could swap the Lighting Data Asset in every scene according to what we need before building (so either one with directional or non-directional lighting data that was both baked before) but like stated above, this doesn't work as well :/

    Additional info: We have a "lights off" function that replaces lightmaps and cubemaps in realtime (prebaked ones for the darker room), disables mixed lights, lightprobes (ambient light is used instead) and emissions of lamp materials. So far so good. Everything worked out in the standalone build so far, but in WebGL we are getting these annoying errors. (because of the directional lightmaps)

    When we bake everything non-directional it works in WebGL too! (albeit without nice specularities, but that is acceptable for WebGL)

    However, we want the directional maps for the Windows/MacOS builds, and non directional for WebGL. Telling Unity to just not use the directional lightmaps (by not setting LightmapData.lightDir) doesn't work. It seems to be determined by the light setting that the scene has? How do I fix this? I don't want to have to apply everything every time I make a build for EVERY scene.

    Is there a way/solutions to kind of adjust the lightsetting/directional/non-directional setting for the respective builds without too much hassle every time??

    THANKS! <3