diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 0afa490bed0..f427a245916 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed path traced subsurface scattering for transmissive surfaces (case 1329403) - Fixed missing context menu for “Post Anti-Aliasing” in Camera (1357283) - Fixed error when disabling opaque objects on a camera with MSAA. +- Fixed double camera preview. ### Changed - Visual Environment ambient mode is now Dynamic by default. 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 31e3f066981..ea3eb38ffe5 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 @@ -1,3 +1,5 @@ +using System; +using System.Reflection; using UnityEngine; using UnityEngine.Experimental.Rendering; using UnityEngine.Rendering.HighDefinition; @@ -14,6 +16,9 @@ partial class HDCameraEditor : Editor Camera[] m_PreviewCameras; HDAdditionalCameraData[] m_PreviewAdditionalCameraDatas; + static readonly Type k_SceneViewCameraOverlay = Type.GetType("UnityEditor.SceneViewCameraOverlay,UnityEditor"); + static readonly FieldInfo k_SceneViewCameraOverlay_ForceDisable = k_SceneViewCameraOverlay.GetField("forceDisable", BindingFlags.Static | BindingFlags.NonPublic); + void OnEnable() { m_SerializedCamera = new SerializedHDCamera(serializedObject); @@ -30,6 +35,9 @@ void OnEnable() // Say that we are a camera editor preview and not just a regular preview m_PreviewAdditionalCameraDatas[i].isEditorCameraPreview = true; } + + // Disable builtin camera overlay + k_SceneViewCameraOverlay_ForceDisable.SetValue(null, true); } void OnDisable() @@ -43,6 +51,9 @@ void OnDisable() DestroyImmediate(m_PreviewCameras[i].gameObject); m_PreviewCameras = null; m_PreviewAdditionalCameraDatas = null; + + // Restore builtin camera overlay + k_SceneViewCameraOverlay_ForceDisable.SetValue(null, false); } public override void OnInspectorGUI()