Skip to content

Commit 3d88d6b

Browse files
fredericv-unity3dsebastienlagarde
authored andcommitted
Fixed an error when switch area light shape to disk while an emissive… #1112
1 parent c9574da commit 3d88d6b

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
151151
- Force to rebake probe with missing baked texture. (1253367)
152152
- Fix issue causing blocky artifacts when decals affect metallic and are applied on material with specular color workflow.
153153
- Appropriately constraint blend distance of reflection probe while editing with the inspector (case 1248931)
154+
- Fixed errors when switching area light to disk shape while an area emissive mesh was displayed.
154155

155156
### Changed
156157
- Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.

com.unity.render-pipelines.high-definition/Editor/Lighting/SerializedHDLight.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,10 @@ public void Update()
464464
settings.Update();
465465

466466
lightGameObject.Update();
467-
deportedAreaLightEmissiveMeshMotionVector?.serializedObject.Update();
468-
deportedAreaLightEmissiveMeshLayer?.serializedObject.Update();
467+
if (deportedAreaLightEmissiveMeshMotionVector.IsTargetAlive())
468+
deportedAreaLightEmissiveMeshMotionVector?.serializedObject.Update();
469+
if (deportedAreaLightEmissiveMeshLayer.IsTargetAlive())
470+
deportedAreaLightEmissiveMeshLayer?.serializedObject.Update();
469471
}
470472

471473
void ApplyInternal(bool withDeportedEmissiveMeshData)
@@ -474,8 +476,10 @@ void ApplyInternal(bool withDeportedEmissiveMeshData)
474476
settings.ApplyModifiedProperties();
475477
if (withDeportedEmissiveMeshData)
476478
{
477-
deportedAreaLightEmissiveMeshMotionVector?.serializedObject.ApplyModifiedProperties();
478-
deportedAreaLightEmissiveMeshLayer?.serializedObject.ApplyModifiedProperties();
479+
if (deportedAreaLightEmissiveMeshMotionVector.IsTargetAlive())
480+
deportedAreaLightEmissiveMeshMotionVector?.serializedObject.ApplyModifiedProperties();
481+
if (deportedAreaLightEmissiveMeshLayer.IsTargetAlive())
482+
deportedAreaLightEmissiveMeshLayer?.serializedObject.ApplyModifiedProperties();
479483
}
480484
}
481485

com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDEditorUtils.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ public static IEnumerable<string> EnumerateDisplayName(this SerializedProperty p
287287
yield return property.displayName;
288288
}
289289

290+
public static bool IsTargetAlive(this SerializedProperty property)
291+
=> property != null && property.serializedObject.targetObject != null &&
292+
!property.serializedObject.targetObject.Equals(null);
293+
290294
/// <summary>
291295
/// Helper to get an enum value from a SerializedProperty.
292296
/// This handle case where index do not correspond to enum value.

0 commit comments

Comments
 (0)