Skip to content

Commit 134d491

Browse files
Fixed an error when switch area light shape to disk while an emissive mesh is displayed. (#1112)
Co-authored-by: sebastienlagarde <[email protected]>
1 parent c915267 commit 134d491

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
@@ -711,6 +711,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
711711
- Fixed glitch in Project settings window when selecting diffusion profiles in material section (case 1253090)
712712
- Fixed issue with light layers bigger than 8 (and above the supported range).
713713
- Fixed issue with culling layer mask of area light's emissive mesh
714+
- Fixed errors when switching area light to disk shape while an area emissive mesh was displayed.
714715

715716
### Changed
716717
- Improve MIP selection for decals on Transparents

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

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

474474
lightGameObject.Update();
475-
deportedAreaLightEmissiveMeshMotionVector?.serializedObject.Update();
476-
deportedAreaLightEmissiveMeshLayer?.serializedObject.Update();
475+
if (deportedAreaLightEmissiveMeshMotionVector.IsTargetAlive())
476+
deportedAreaLightEmissiveMeshMotionVector?.serializedObject.Update();
477+
if (deportedAreaLightEmissiveMeshLayer.IsTargetAlive())
478+
deportedAreaLightEmissiveMeshLayer?.serializedObject.Update();
477479
}
478480

479481
void ApplyInternal(bool withDeportedEmissiveMeshData)
@@ -482,8 +484,10 @@ void ApplyInternal(bool withDeportedEmissiveMeshData)
482484
settings.ApplyModifiedProperties();
483485
if (withDeportedEmissiveMeshData)
484486
{
485-
deportedAreaLightEmissiveMeshMotionVector?.serializedObject.ApplyModifiedProperties();
486-
deportedAreaLightEmissiveMeshLayer?.serializedObject.ApplyModifiedProperties();
487+
if (deportedAreaLightEmissiveMeshMotionVector.IsTargetAlive())
488+
deportedAreaLightEmissiveMeshMotionVector?.serializedObject.ApplyModifiedProperties();
489+
if (deportedAreaLightEmissiveMeshLayer.IsTargetAlive())
490+
deportedAreaLightEmissiveMeshLayer?.serializedObject.ApplyModifiedProperties();
487491
}
488492
}
489493

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)