Skip to content

Commit 102ce99

Browse files
[Backport 8.x.x] Fixed a null ref exception in static sky when the default volume profile is invalid. (#302)
* Fixed a null ref exception in static sky when the default volume profile is invalid. * Update changelog.
1 parent 1b9cdc2 commit 102ce99

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111
- Fixed the indirect diffuse texture not being ignored when it should (ray tracing disabled).
1212
- Fixed a performance issue with stochastic ray traced area shadows.
1313
- Made more explicit the warning about raytracing and asynchronous compute. Also fixed the condition in which it appears.
14+
- Fixed a null ref exception in static sky when the default volume profile is invalid.
1415

1516
### Changed
1617
- Shadowmask and realtime reflection probe property are hide in Quality settings

com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ void UpdateCurrentStaticLightingSky()
125125
var profileSkyParameters = m_SkySettingsFromProfile.parameters;
126126

127127
var defaultVolume = HDRenderPipeline.GetOrCreateDefaultVolume();
128-
defaultVolume.sharedProfile.TryGet(skyType, out SkySettings defaultSky);
128+
SkySettings defaultSky = null;
129+
if (defaultVolume.sharedProfile != null) // This can happen with old projects.
130+
defaultVolume.sharedProfile.TryGet(skyType, out defaultSky);
129131
var defaultSkyParameters = defaultSky != null ? defaultSky.parameters : null; // Can be null if the profile does not contain the component.
130132

131133
// Seems to inexplicably happen sometimes on domain reload.

0 commit comments

Comments
 (0)