Search Unity

Official [2020.1] New Feature - Lighting Settings Asset

Discussion in 'Global Illumination' started by kristijonas_unity, Feb 21, 2020.

  1. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    LSA-FeatureImage.jpg
    A simple diagram showing how to access the feature via the UI.

    Overview
    This feature was developed by Jennifer Nordwall (@JenniferNordwall).

    Improvements introduced by the Lighting Settings Asset (LSA) feature
    • Ability to change settings on multiple scenes and having more control in multi-bake scenarios.
    • Lighting settings are no longer a part of the Unity scene file; instead they are now located in an independent file that stores all the settings related to pre-computed GI.
    Benefits to the users
    • Lighting settings can now be easily shared between different scenes.
    • Ability to toggle between different lighting settings quickly.
    • Lighting settings asset file can easily be assigned to a scene, removed or modified (either through the Inspector UI or API). This allows for much faster iterations when authoring lighting settings.
    • A single lighting settings asset file can be used by multiple scenes without need to manually tweak the settings for every scene.
    Setup instructions
    Via the UI
    1. Open Lighting window by navigating to Window > Rendering > Lighting.
    2. Click on New Lighting Settings button located at the top of the window.
    3. Your newly created Lighting Settings Asset is going to be assigned and located next to the opened scene's file.
    4. Either select the asset directly from the Project folder, or edit the asset in the Lighting window after assigning it to the Lighting Settings slot.
    Note: Currently, the Lighting Settings asset will be automatically created in the folder located next to the Unity scene file when opening the scene after upgrading to the recent 2020.1.0/trunk branch, but only if the lighting settings of this upgraded scene were changed from the default values. We are going change that behavior for the upcoming 2020.1.0 beta version, so that the asset would only be created after making changes to the lighting settings of the upgraded scene (i.e. changing the lightmapper backend) and then manually saving the scene.

    Via C# code
    Creating the asset:
    Code (CSharp):
    1. Lightmapping.lightingSettings = new LightingSettings();
    2. ProjectWindowUtil.CreateAsset(Lightmapping.lightingSettings, "My new lighting settings asset.lighting");
    Setting directionality mode:
    Code (CSharp):
    1. Lightmapping.lightingSettings.directionalityMode = value;
    Feature access & feedback
    You can get access to the feature by downloading the latest 2020.1 alpha build via the Unity Hub, or via this link - https://unity3d.com/alpha/2020.1a#downloads. We are looking forward to hearing your feedback!
     
    Last edited: Mar 9, 2020
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,756
    Is this not optional? Do I have to clutter my project with a gazillion lighting settings asset files so I can safely edit the settings of a certain scene without affecting other scenes?
     
    robby702, snifo, xmarleauFFG and 4 others like this.
  3. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Just put the settings file next to you Lighting Data Asset, or create it from code :)
     
  4. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    thank u Jennifer, good work!
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,756
    Is being unable to edit lighting settings from the Lighting tab an intended design decision, or is it a bug?

    (I can only change settings by clicking the settings asset and editing in inspector, the lighting window itself does not allow me to type new values).
     
  6. unit_dev123

    unit_dev123

    Joined:
    Feb 10, 2020
    Posts:
    989
    Not yet ready maybe remember this is wip
     
  7. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Make sure that you have a LSA assigned in the Lighting Settings window. If there's no asset assigned, you will not be able to edit any values in the Lighting Settings window.
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,756
    Nah, it's some sort of bug. The asset is assigned correctly. It happens after I do a bake and it's only for inputting values with keyboard. If I click and drag to increase/decrease values, then it works properly (and uses the correct values). If I type values, nothing happens.

    Probably some sort of UI bug that is unrelated to the LSA feature.
     
  9. DavidLlewelyn

    DavidLlewelyn

    Unity Technologies

    Joined:
    Aug 14, 2012
    Posts:
    34
    @AcidArrow is the Lighting Settings Asset actually assigned in the Lighting window? If it is not assigned, you will be viewing the default values which are not editable by design.
     
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,756
    Yes. And also I wasn’t viewing the default values.

    I will post a short video if I find the time later today.
     
  11. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,756
    Here's a video @DavidLlewelyn and @kristijonas_unity

    Some notes:

    1. You need to start a bake and let if finish normally by itself for it to repro. Before I do that it seems to work fine. I'm using the GPU baker, not sure if it matters.
    2. When I'm selecting the various fields in the video I am typing things. Please don't ask me to record myself trying to type things.
    3. I can edit values with a mouse, just not with a keyboard.
    4. At around 11seconds, I am selecting the asset directly and editing it in inspector (just clarifying because I cut off the top by mistake). I can edit the asset in the inspector fine with both mouse and keyboard. And as you can see they update the settings in the lighting settings window, meaning the asset is set correctly.
    5. I hope you can see that this mean that the asset is properly set in the lighting settings.
    6. I will not submit a bug report, if this is not enough for you to fix it, then it might as well stay unfixed.

    EDIT: 7. I did not try it in the video, but maybe you can take my word for it, copy pasting (with keyboard) also works.

     
    Last edited: Feb 24, 2020
    Jesper-Mortensen likes this.
  12. V_Kalinichenko

    V_Kalinichenko

    Unity Technologies

    Joined:
    Apr 15, 2015
    Posts:
    16
    Hey, thanks a lot for finding this bug! FYI, I've submitted it here: https://issuetracker.unity3d.com/is...-keyboard-after-switching-between-editor-tabs
    It looks like it's unrelated to the LSA feature, as this is a regression introduced in 2020.1.0a23.
    In any case, our developers will take a look at it and fix it as soon as possible.
    Cheers!
     
    kristijonas_unity and AcidArrow like this.
  13. CD_MT

    CD_MT

    Joined:
    Jul 18, 2019
    Posts:
    9
    Nice Work - this will be a massive improvement, thanks!... very keen to try this as soon as I get a chance.

    Could you tell me @JenniferNordwall @DavidLlewelyn - how these settings relate to baking a scene comprised from several sub scenes?

    Light settings currently exist for each subscene. Though we endeavor to maintain a 'lighting scene' which holds our required bake settings, the settings will will invariably differ across the other subscenes. As a result we regularly get into a tangle due to the 'wrong' subscene being active :

    The overall 'look' may immediately differ (skybox, fog etc)
    Baking may produce several directories of redundant baked data (named depending on active subScene)
    + AutoGenerate accidentally left on in any subscene exacerbates the above issue.

    Clearly the first of these issues is fixed with your new settings - but what of the actual baking? Can the new settings also provide the 'path' to which the baked data is written, for example?
     
  14. CD_MT

    CD_MT

    Joined:
    Jul 18, 2019
    Posts:
    9
  15. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Hi

    Currently, skybox and fog are part of the scene and render settings, which we haven't moved to its separate file yet (and might never do since most of those things will be redone in the SRP workflow). So these settings will be attached to the active scene (which is also being used to fetch the current lighting settings). The active scene workflow is so rooted into how everything works in Unity, but hopefully the lighting settings workflow helped a bit with this.

    As for the bake location, what problem will this solve? I just want to fully understand your situation and why this would be a good solution for you.

    Thanks :)
     
  16. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
    It would be extremely useful to have the lighting environment settings as a .asset. We modify the ambient color, and skybox as part of in game "transformation events" in our scenes. Having the environment settings as asset would make previewing and setting this up in the editor much more straight forward.

    Right not we just use a scriptable with a custom script, we can obviously keep doing this, but it would be easier if it was supported directly.
     
  17. zapposh

    zapposh

    Joined:
    Nov 12, 2016
    Posts:
    117
    Why is this being generated every time I save a scene in 2020.1?
    I have a 2D renderer, no lights in any scene, and all lighting settings are disabled everywhere in the project and URP.
    All sprites use the UNLIT material.
    Is this a bug?

    I keep deleting the files every time they are generated to stop them clogging up my hierarchy for nothing.
     
    robby702, snifo and sean244 like this.
  18. Earthshine

    Earthshine

    Joined:
    Jul 24, 2020
    Posts:
    1
    It seems to be no way to choose default lighting settings (Settings.lighting). I've switched a project to 2020.1 and all the scenes got default settings, except one that got (None) and would only receive a separate settings.lighting asset. It's a mild inconvenience but still looks like a bug.
     
  19. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    98
    Thank you all!
    I am getting really weird maps though now ...
    So I disabled all lights and probes in scene. Everything is set to Bake in Lighting tab. I even took off all environmental setting and I still get a bake but only generated @ runtime..?

    Weird right?
     

    Attached Files:

  20. darthbator

    darthbator

    Joined:
    Jan 21, 2012
    Posts:
    169
    Is there a way to use the global asset by default and not generate an individual file for every scene now? The project clutter is highly undesirable for the majority of smaller unity projects that don't require per scene global illumination settings.
     
    xmarleauFFG and astracat111 like this.
  21. unknowndevice

    unknowndevice

    Joined:
    Sep 13, 2016
    Posts:
    86
    If you just make an asset, and assign it to every scene it'll stop generating them.
     
  22. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    It only does this when it upgrades so that you don't loose your settings. Just assign the LSA to null, and remove the files :) It's not the perfect solution, but I didn't wanna risk destroying peoples settings.
     
  23. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    I'm still looking for how to turn the creation of a brand new file off when saving a scene. For now I'm just deleting the lighting settings file, because I simply use real time shadows with no baked lighting (saves MB on disk and is faster to develop for).

    I have an OnRenderObject() and looking to assign the same default lighting settings object to every scene.

    I've got:

    Code (CSharp):
    1.  
    2. //On start:
    3. LightingSettings lightingSettings = new LightingSettings();
    4.  
    5. if (lightingSettings. ??? == null)
    6.    lightingSettings. ??? = Resources.Load("LightingSettings/") etc etc...
    Not sure how to go about this...
     
  24. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Since I didn't want to use baked lighting and couldn't figure out how to load a lighting settings file from Load.Resources, I just put this in the beginning of the script that I have on every scene.

    Again, the complication is that I'm not wanting to use any baked lighting whatsoever:


    Code (CSharp):
    1.     public LightingSettings SetLightingSettings(LightingSettings lightingSettings)
    2.     {
    3.         lightingSettings = new LightingSettings();
    4.         lightingSettings.albedoBoost = 0;
    5.         lightingSettings.ao = false;
    6.         lightingSettings.aoExponentDirect = 0;
    7.         lightingSettings.aoExponentIndirect = 0;
    8.         lightingSettings.aoMaxDistance = 0;
    9.         lightingSettings.autoGenerate = false;
    10.         lightingSettings.bakedGI = false;
    11.         lightingSettings.bounces = 0;
    12.         lightingSettings.compressLightmaps = false;
    13.         lightingSettings.denoiserTypeAO = LightingSettings.DenoiserType.None;
    14.         lightingSettings.denoiserTypeDirect = LightingSettings.DenoiserType.None;
    15.         lightingSettings.denoiserTypeIndirect = LightingSettings.DenoiserType.None;
    16.         lightingSettings.directionalityMode = LightmapsMode.NonDirectional;
    17.         lightingSettings.directSampleCount = 32;
    18.         lightingSettings.environmentSampleCount = 256;
    19.         lightingSettings.exportTrainingData = false;
    20.         lightingSettings.extractAO = false;
    21.         lightingSettings.filteringAtrousPositionSigmaAO = 1;
    22.         lightingSettings.filteringAtrousPositionSigmaDirect = 0.5f;
    23.         lightingSettings.filteringAtrousPositionSigmaIndirect = 2;
    24.         lightingSettings.filteringGaussRadiusAO = 2;
    25.         lightingSettings.filteringGaussRadiusDirect = 1;
    26.         lightingSettings.filteringMode = LightingSettings.FilterMode.None;
    27.         lightingSettings.filterTypeAO = LightingSettings.FilterType.None;
    28.         lightingSettings.filterTypeDirect = LightingSettings.FilterType.None;
    29.         lightingSettings.filterTypeIndirect = LightingSettings.FilterType.None;
    30.         lightingSettings.indirectResolution = 0;
    31.         lightingSettings.indirectSampleCount = 512;
    32.         lightingSettings.indirectScale = 1;
    33.         lightingSettings.lightmapMaxSize = 1;
    34.         lightingSettings.lightmapPadding = 1;
    35.         lightingSettings.lightmapper = LightingSettings.Lightmapper.ProgressiveGPU;
    36.         lightingSettings.lightmapResolution = 1;
    37.         lightingSettings.lightProbeSampleCountMultiplier = 4;
    38.         lightingSettings.mixedBakeMode = MixedLightingMode.Shadowmask;
    39.         lightingSettings.name = "BASIC";
    40.         lightingSettings.prioritizeView = true;
    41.         lightingSettings.realtimeEnvironmentLighting = false;
    42.         lightingSettings.realtimeGI = false;
    43.         lightingSettings.russianRouletteStartBounce = 0;
    44.         lightingSettings.sampling = 0;
    45.         lightingSettings.trainingDataDestination = "";
    46.  
    47.         return lightingSettings;
    48.     }
    49.  
     
  25. arielsan

    arielsan

    Joined:
    Dec 3, 2013
    Posts:
    47
    Is there a way to turn it off or at least select the default settings in some place and then every scene uses that one? we have tons of scenes and each time someone modify one of them, we get a new auto generated lighting settings we don't use nor want.

    Yes, I know I could open each scene with a script and maybe configure the default setting, I was hoping to set something that would work in the long term (new scenes), I suppose I could create a post import action to set the default settings too.
     
    astracat111 likes this.
  26. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    @arielsan If you wanna give a crack at it, I'm working on an editor script that's supposed to set the lighting settings data object to a default asset in the editor if it's equal to null or not equal to the default one you choose.

    It seems to be Lightmapping.lightingDataAsset, but I can't get it to change. It also says that the scene needs to be re-opened before the changes are made (odd), but even with this code it doesn't seem to want to change:

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3. using UnityEditor.SceneManagement;
    4. using UnityEngine.SceneManagement;
    5.  
    6. [InitializeOnLoad]
    7. class EditorUpdate
    8. {
    9.  
    10.     public static string GlobalLightingSettingsName = "Default";
    11.  
    12.     static EditorUpdate()
    13.     {
    14.         EditorApplication.update += Update;
    15.     }
    16.  
    17.     static void Update()
    18.     {
    19.         Debug.Log(Lightmapping.lightingDataAsset);
    20.  
    21.         if (Lightmapping.lightingDataAsset != null)
    22.             Debug.Log(Lightmapping.lightingDataAsset.name);
    23.  
    24.         if (Lightmapping.lightingDataAsset == null)
    25.             SwitchLightingSettingsToDefault();
    26.  
    27.         if (Lightmapping.lightingDataAsset != null)
    28.         {
    29.             if (Lightmapping.lightingDataAsset.name != GlobalLightingSettingsName)
    30.                 SwitchLightingSettingsToDefault();
    31.         }
    32.  
    33.     }
    34.  
    35.     private static void SwitchLightingSettingsToDefault()
    36.     {
    37.         Debug.Log("switch here");
    38.  
    39.         string path = "LightingSettings/" + GlobalLightingSettingsName;
    40.  
    41.         Debug.Log("path = " + path);
    42.  
    43.         Lightmapping.lightingDataAsset = Resources.Load(path) as LightingDataAsset;
    44.         EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
    45.     }
    46.  
    47. }
     
  27. arielsan

    arielsan

    Joined:
    Dec 3, 2013
    Posts:
    47
    Thanks @astracat111 !! yeah, ended up with a script that opens all scenes and reset to our own lighting settings, with everything turned off.

    Code (CSharp):
    1.  
    2. [MenuItem("Assets/Refactors/Remove Lighting Settings from Scenes", false, 21)]
    3. public static void RemoveLightingSettingsFromAllScenes()
    4. {
    5.     var allScenesGuids = new List<string>();
    6.  
    7.     // Here we filter by all assets of type scene but under Assets folder to avoid all other scenes from
    8.     // external packages.
    9.     allScenesGuids.AddRange(AssetDatabase.FindAssets("t:scene", new string[]
    10.     {
    11.         "Assets"
    12.     }));
    13.  
    14.     Debug.Log("count: " + allScenesGuids.Count);
    15.  
    16.     EditorUtility.DisplayProgressBar("Removing lighting settings", "Starting...", 0);
    17.     EditorSceneManager.sceneOpened += RemoveLightingSettings;
    18.    
    19.     var allScenesCount = allScenesGuids.Count;
    20.     for (var i = 0; i < allScenesCount; i++)
    21.     {
    22.         var sceneGuid = allScenesGuids[i];
    23.         var scenePath = AssetDatabase.GUIDToAssetPath(sceneGuid);
    24.        
    25.         try
    26.         {
    27.             EditorUtility.DisplayProgressBar("Removing lighting settings", scenePath,
    28.                 i / (float) allScenesCount);
    29.             EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single);
    30.         }
    31.         catch (Exception ex)
    32.         {
    33.             Debug.Log("ERROR: " + ex.Message);
    34.         }
    35.     }
    36.  
    37.     EditorSceneManager.sceneOpened -= RemoveLightingSettings;
    38.     EditorUtility.ClearProgressBar();
    39. }
    40.  
    41. private static void RemoveLightingSettings(Scene scene, OpenSceneMode mode)
    42. {
    43.     var lightingSettings = AssetDatabase.LoadAssetAtPath<LightingSettings>("Assets/Bundles/LightingSettings.lighting");
    44.     Lightmapping.lightingSettings = lightingSettings;
    45.     // Lightmapping.lightingDataAsset = null;
    46.     EditorSceneManager.MarkSceneDirty(scene);
    47.     EditorSceneManager.SaveScene(scene);
    48. }
    49.  
    I am thinking about creating an editor on open scene callback static method which does this, so new scenes are also configured.
     
    astracat111 likes this.
  28. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    I've also tried:

    Code (CSharp):
    1. Lightmapping.lightingDataAsset = AssetDatabase.LoadAssetAtPath(Application.dataPath + "/LightingSettings/Default.lighting", typeof(LightingDataAsset)) as LightingDataAsset;
    But still can't get this:



    To change through code in the editor...
     
  29. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Oooh okay, you simply do:

    Code (CSharp):
    1.   var lightingSettings = AssetDatabase.LoadAssetAtPath<LightingSettings>("Assets/Bundles/LightingSettings.lighting");
    2.     Lightmapping.lightingSettings = lightingSettings;
    3.     // Lightmapping.lightingDataAsset = null;
    4.     EditorSceneManager.MarkSceneDirty(scene);
    5.     EditorSceneManager.SaveScene(scene);
    I'll test that out and see what works...

    EDIT: Nope, I've still got nothing when I do:

    Code (CSharp):
    1. Lightmapping.lightingSettings = AssetDatabase.LoadAssetAtPath(Application.dataPath + "/LightingSettings/" + GlobalLightingSettingsName + ".lighting", typeof(LightingSettings)) as LightingSettings;
     
  30. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Success! Fixed it, now if you want a single lighting settings this editor script (put in an Editor folder) will automatically keep every scene always at the lighting settings you specify with 'LightingSettingsName' and 'LightingSettingsAssetPath'.

    No need to create a whole saving every scene script, just open your scenes, it'll mark it as dirty and it'll save them. If you try to change the lighting settings it'll automatically switch it back to the default one so that you can't. This'll stop it from creating a file for every scene for bigger projects in where that'd create a ton of extra files.

    One big problem is that I didn't know how to check the Lightmapping.lightingSettings object because it keeps stating it's null when you try to check it for being null so I just put a try catch statement in there. Maybe some advanced programmer has some magic way to do it.

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3. using UnityEditor.SceneManagement;
    4.  
    5. [InitializeOnLoad]
    6. class EditorUpdate
    7. {
    8.  
    9.     public static string LightingSettingsAssetPath = "Assets/LightingSettings/Default.lighting";
    10.     public static string LightingSettingsName = "Default";
    11.  
    12.     static EditorUpdate()
    13.     {
    14.         EditorApplication.update += CheckLightingSettings;
    15.     }
    16.  
    17.     static void CheckLightingSettings()
    18.     {
    19.         if (Application.isPlaying == false) {
    20.         try
    21.         {
    22.             SwitchLightingSettingsIfNotDefault();
    23.         }
    24.         catch
    25.         {
    26.             SwitchLightingSettingsToDefault();
    27.         }
    28.         }
    29.     }
    30.  
    31.     private static void SwitchLightingSettingsIfNotDefault()
    32.     {
    33.         if (Lightmapping.lightingSettings != null)
    34.         {
    35.             if (Lightmapping.lightingSettings.name != LightingSettingsName)
    36.             {
    37.                 SwitchLightingSettingsToDefault();
    38.             }
    39.         }
    40.     }
    41.  
    42.     private static void SwitchLightingSettingsToDefault()
    43.     {
    44.         Lightmapping.lightingSettings = AssetDatabase.LoadAssetAtPath(LightingSettingsAssetPath, typeof(LightingSettings)) as LightingSettings;
    45.         EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
    46.     }
    47.  
    48. }
     
    Last edited: Aug 7, 2020
  31. caletbak-sp

    caletbak-sp

    Joined:
    Dec 11, 2018
    Posts:
    6
    Is this only available in Unity 2020 or it could work in 2019.4.7 with some package installation?
     
  32. JenniferNordwall

    JenniferNordwall

    Unity Technologies

    Joined:
    Sep 19, 2016
    Posts:
    160
    Hi
    All this are default features in the engine and doesn't live in a package. So unfortunately no :/ Sorry
     
  33. Jamez0r

    Jamez0r

    Joined:
    Jul 29, 2019
    Posts:
    205
    @JenniferNordwall I'm getting these Settings.lighting files in my 2D project that uses URP with the 2D Renderer. Unity version 2020.1.2f1.

    Do I need these files for a 2D project? Should I have them? I am using the Experimental 2D Lights, but I'm not sure that these files have anything to do with that. I also use Collab with 3 other team members, so maybe if these lighting files aren't supposed to be generated for a 2D project they somehow got generated due to Collab's initial project download/setup?

    Thanks for any help!
     
  34. jleven22

    jleven22

    Joined:
    Mar 26, 2019
    Posts:
    421
    I want to second this - can I turn off this feature? My game does not have lighting - so this is useless for me.
     
  35. Nomadjackalope

    Nomadjackalope

    Joined:
    Jul 12, 2016
    Posts:
    16
    Yes, how do we turn this auto creation of files off? My project only uses UI, no lighting.
     
    jleven22 likes this.
  36. tetriser016

    tetriser016

    Joined:
    Jan 3, 2014
    Posts:
    100
    I also need a solution on this, I'm working on a 2D game with no lighting at all
     
  37. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Yeah, we also updated our project to 2020.1.16f1 and I was a bit overwhelmed, when I opened one of my scenes, added a GameObject and saved the scene and all of a sudden a Lighting Settings Asset was created.

    We use URP and the 2D Renderer and actually have some 2D Lights in the scene, but do we actually need the lighting settings asset? I removed them and everything still worked.

    So how to turn off the autogeneration?
     
  38. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Going to bump this hoping someone from Unity will chime in
     
  39. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    I'll raise this internally for you and ensure you get an answer back. Apologies for the delay here.
     
    Earthshine likes this.
  40. duartedd

    duartedd

    Joined:
    Aug 1, 2017
    Posts:
    150
    filed bug report - happened in 2020.2.1f1 which is latest as i write this.
     
  41. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    184
    If you don't want the LightingSettings assets cluttering your project, to get the old behavior, I've discovered you can press the "New Lighting Settings" button and then hit ESC when it shows up in the project view.

    I haven't seen any problems with this technique yet... but I'll update if I run into any.
     
  42. Gladyon

    Gladyon

    Joined:
    Sep 10, 2015
    Posts:
    389
    I agree that this auto-generation is quite frustrating.
    I put my scenes in AssetBundles so I have to delete the new files because you cannot put scene assets and other assets in the same bundle.
     
  43. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    Hi,

    I am curious to know why is LightingSettings under UnityEngine and not UnityEditor?
     
    AcidArrow likes this.
  44. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,756
    Good question.
     
  45. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Hi
    I want to get access to the Lightmap parameters (switch to very low)
    Untitled.jpg

    I already used reflections but currently not working on the unity 2020.2
    Code (CSharp):
    1. public static void SetLightmapParameters(LightmapParameters parameter)
    2.     {
    3.         SetObject("m_LightmapEditorSettings.m_LightmapParameters", (Object) parameter);
    4.     }
    Code (CSharp):
    1. LightmapParameters a = new LightmapParameters ();
    2.            
    3.             a.name = "Lighting Box Very-Low";
    4.             a.resolution = 0.125f;
    5.             a.clusterResolution = 0.4f;
    6.             a.irradianceBudget = 96;
    7.             a.irradianceQuality = 8192;
    8.             a.modellingTolerance = 0.001f;
    9.             a.stitchEdges = true;
    10.             a.isTransparent = false;
    11.             a.systemTag = -1;
    12.             a.blurRadius = 2;
    13.             a.antiAliasingSamples = 8;
    14.             a.directLightQuality = 64;
    15.             a.bakedLightmapTag = -1;
    16.             a.AOQuality = 256;
    17.             a.AOAntiAliasingSamples = 16;
    18.             a.backFaceTolerance = backfaceTolerance;
    19.  
    20.             LB_LightingSettingsHepler.SetLightmapParameters (a);
    21.  
     
  46. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Fixed by replacing line 20 with this one :
    Code (CSharp):
    1.             LightmapParameters.SetLightmapParametersForLightingSettings(a, Lightmapping.lightingSettings);
    2.  
     
  47. caletbak-sp

    caletbak-sp

    Joined:
    Dec 11, 2018
    Posts:
    6
    Hi!, is there a way this feature will be available from Unity Engine code instead of Editor? As this is very useful in many scenarios in which you need to change the Lightmap and lighting settings from 1 screen to other without loading scenes.
     
    MostHated likes this.
  48. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,756
    I'm a bit confused, after using this feature, why are LightmapSettings still in the scene file?
     
  49. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    324
    IIRC, along with containing actual baked data, LightmapSettings stores some internal data that is inherently coupled to a specific scene. LightingSettings just contains input settings for a bake, and is completely agnostic of any scene, so can be reused anywhere.
     
  50. Rich_A

    Rich_A

    Joined:
    Nov 22, 2016
    Posts:
    338
    Can you please add Baked and Realtime light falloff settings into this UI?

    I want to change URP falloff back to legacy (It should never have been changed for URP in the first place)