From 1a8cabb13828b684deb76a2891e084e7a06121f4 Mon Sep 17 00:00:00 2001 From: martint-unity Date: Mon, 21 Sep 2020 16:48:52 +0200 Subject: [PATCH 1/2] fix case 1244430 removing camera comp from prefab --- .../RenderPipeline/Camera/HDCameraEditor.cs | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraEditor.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraEditor.cs index 138fdd7e192..bc84862c7be 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraEditor.cs @@ -78,15 +78,32 @@ public void RemoveComponent(Camera camera, IEnumerable dependencies) return; } - Undo.SetCurrentGroupName("Remove HD Camera"); - var additionalCameraData = camera.GetComponent(); - if (additionalCameraData) + var isAssetEditing = EditorUtility.IsPersistent(camera); + try { - Undo.DestroyObjectImmediate(additionalCameraData); + if (isAssetEditing) + { + AssetDatabase.StartAssetEditing(); + } + + Undo.SetCurrentGroupName("Remove HD Camera"); + var additionalCameraData = camera.GetComponent(); + if (additionalCameraData != null) + { + Undo.DestroyObjectImmediate(additionalCameraData); + } + + Undo.DestroyObjectImmediate(camera); + } + finally + { + if (isAssetEditing) + { + AssetDatabase.StopAssetEditing(); + } } - Undo.DestroyObjectImmediate(camera); } - + [MenuItem("CONTEXT/Camera/Reset", false, 0)] static void ResetCamera(MenuCommand menuCommand) { From f1bad37c07f8f5dce57da41577c8a342bab7e7b7 Mon Sep 17 00:00:00 2001 From: martint-unity Date: Tue, 22 Sep 2020 08:20:44 +0200 Subject: [PATCH 2/2] Updated change log --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 421d3c6e66a..cdc0fb701ab 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed AOV export of depth buffer which now correctly export linear depth (case 1265001) - Fixed issue that caused the decal atlas to not be updated upon changing of the decal textures content. - Fixed "Screen position out of view frustum" error when camera is at exactly the planar reflection probe location. +- Fixed an issue that caused a null reference when deleting camera component in a prefab. (case 1244430) ### Changed - Preparation pass for RTSSShadows to be supported by render graph.