From 50a785001ea0132109438961d1a506ce1093b531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Vauchelles?= Date: Thu, 14 May 2020 08:53:57 +0200 Subject: [PATCH] Check reflection probe null pointer before use. (case 1244047) --- .../CHANGELOG.md | 1 + .../Reflection/HDAdditionalReflectionData.Legacy.cs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index eadbecca818..80c5c763e09 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -595,6 +595,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed some GCAlloc in the debug window. - Fixed shader graphs not casting semi-transparent and color shadows (case 1242617) - Fixed thin refraction mode not working properly. +- Fixed error when undo a Reflection Probe removal in a prefab instance. (case 1244047) ### Changed - Improve MIP selection for decals on Transparents diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDAdditionalReflectionData.Legacy.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDAdditionalReflectionData.Legacy.cs index 1b979ba2b23..1f446401766 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDAdditionalReflectionData.Legacy.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDAdditionalReflectionData.Legacy.cs @@ -30,6 +30,16 @@ public override void PrepareCulling() var tr = transform; var position = tr.position; var cubeProbe = reflectionProbe; + + if (cubeProbe == null || cubeProbe.Equals(null)) + { + // case 1244047 + // This can happen when removing the component from the editor and then undo the remove. + // The order of call maybe incorrect and the code flows here before the reflection probe + // is restored. + return; + } + switch (influence.shape) { case InfluenceShape.Box: