diff --git a/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs b/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs index c6542f29343..683b01e921a 100644 --- a/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs +++ b/com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs @@ -96,7 +96,12 @@ protected virtual void OnEnable() .AsReadOnly(); foreach (var parameter in parameters) - parameter.OnEnable(); + { + if(parameter != null) + parameter.OnEnable(); + else + Debug.LogWarning("Volume Component " + GetType().Name + " contains a null parameter; please make sure all parameters are initialized to a default value. Until this is fixed the null parameters will not be considered by the system."); + } } /// @@ -108,7 +113,10 @@ protected virtual void OnDisable() return; foreach (var parameter in parameters) - parameter.OnDisable(); + { + if (parameter != null) + parameter.OnDisable(); + } } /// /// Interpolates a with this component by an interpolation @@ -222,7 +230,10 @@ public override int GetHashCode() public void Release() { for (int i = 0; i < parameters.Count; i++) - parameters[i].Release(); + { + if(parameters[i] != null) + parameters[i].Release(); + } } } } diff --git a/com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs b/com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs index d0dd19d3cc9..cec5e48e5a8 100644 --- a/com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs +++ b/com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs @@ -227,8 +227,11 @@ void ReplaceData(VolumeStack stack, List components) for (int i = 0; i < count; i++) { - target.parameters[i].overrideState = false; - target.parameters[i].SetValue(component.parameters[i]); + if(target.parameters[i] != null) + { + target.parameters[i].overrideState = false; + target.parameters[i].SetValue(component.parameters[i]); + } } } } diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 941e56fa464..288b1580fbe 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog +# Changelog All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -48,6 +48,7 @@ The version number for this package has increased due to a version update of a r - Fixed the ray tracing shadow UI being displayed while it shouldn't (case 1286391). - Fixed issues with physically-based DoF, improved speed and robustness - Fixed a warning happening when putting the range of lights to 0. +- Fixed issue when null parameters in a volume component would spam null reference errors. Produce a warning instead. ### Changed - Combined occlusion meshes into one to reduce draw calls and state changes with XR single-pass.