Search Unity

Question ColorAdjustsments volume override is missing settings after restart

Discussion in 'High Definition Render Pipeline' started by se, Sep 27, 2021.

  1. se

    se

    Joined:
    May 20, 2013
    Posts:
    46
    I noticed that in one of my script-created volume profiles the settings for the ColorAdjustments override are missing after I restart Unity (2021.1.22).

    It looks like the settings go missing unless at least one of a few specific overrides are present as well. I can't tell what's special about them. For example adding Fog works, but adding ScreenSpaceReflection does not.

    Is there a reason for this? I'd appreciate it if someone could test the script below and tell me if it's reproducible.

    • Add script to Assets/Scritps/Editor
    • Go to "Window ➜ VolumeProfileTest" and click "Create"
    • Don't change anything in the volume profiles
    • Restart Unity
    • VolumeProfile1.asset should be missing its "Color Adjustments ➜ Post Exposure" setting
    • VolumeProfile2.asset should still have it

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEditor.Rendering;
    3. using UnityEngine;
    4. using UnityEngine.Rendering.HighDefinition;
    5.  
    6. public class Window : EditorWindow
    7. {
    8.     [MenuItem("Window/VolumeProfileTest")]
    9.     public static void ShowWindow()
    10.     {
    11.         GetWindow<Window>("VolumeProfileTest");
    12.     }
    13.  
    14.     private void OnGUI()
    15.     {
    16.         if (GUILayout.Button("Create")) {
    17.             CreateVolumeProfile1();
    18.             CreateVolumeProfile2();
    19.         }
    20.     }
    21.  
    22.     private void CreateVolumeProfile1()
    23.     {
    24.         var volumeProfile1 = VolumeProfileFactory.CreateVolumeProfileAtPath("Assets/VolumeProfile1.asset");
    25.  
    26.         var colorAdjustments = VolumeProfileFactory.CreateVolumeComponent<ColorAdjustments>(volumeProfile1);
    27.  
    28.         // Missing after restart
    29.         colorAdjustments.postExposure.overrideState = true;
    30.         colorAdjustments.postExposure.value = 2;
    31.     }
    32.  
    33.     private void CreateVolumeProfile2()
    34.     {
    35.         var volumeProfile2 = VolumeProfileFactory.CreateVolumeProfileAtPath("Assets/VolumeProfile2.asset");
    36.  
    37.         // "Bugfix"
    38.         VolumeProfileFactory.CreateVolumeComponent<Fog>(volumeProfile2);
    39.  
    40.         var colorAdjustments = VolumeProfileFactory.CreateVolumeComponent<ColorAdjustments>(volumeProfile2);
    41.  
    42.         // Remain after restart
    43.         colorAdjustments.postExposure.overrideState = true;
    44.         colorAdjustments.postExposure.value = 2;
    45.     }
    46. }