diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index 7986dc8671f..ae752f06d70 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [13.1.1] - 2021-10-04 ### Added +- Added a warning when using Pixel Perfect Camera in SRP without a 2D Renderer and exposed RenderPipelineConverter for 2D Pixel Perfect to URP converter. - Added Depth Texture setting for Overlay Camera. - Added Depth Priming support for Vulkan with MSAA. - Added Shadows and Additional Lights off variants stripping. diff --git a/com.unity.render-pipelines.universal/Editor/2D/PixelPerfectCameraEditor.cs b/com.unity.render-pipelines.universal/Editor/2D/PixelPerfectCameraEditor.cs index b86157b2a55..a6bd89d2670 100644 --- a/com.unity.render-pipelines.universal/Editor/2D/PixelPerfectCameraEditor.cs +++ b/com.unity.render-pipelines.universal/Editor/2D/PixelPerfectCameraEditor.cs @@ -21,7 +21,8 @@ private class Style public GUIContent currentPixelRatio = new GUIContent("Current Pixel Ratio", "Ratio of the rendered Sprites compared to their original size."); public GUIContent runInEditMode = new GUIContent("Run In Edit Mode", "Enable this to preview Camera setting changes in Edit Mode. This will cause constant changes to the Scene while active."); public const string cameraStackingWarning = "Pixel Perfect Camera won't function properly if stacked with another camera."; - public const string nonRenderer2DError = "Pixel Perfect Camera requires a camera using a 2D Renderer."; + public const string nonRenderer2DWarning = "URP Pixel Perfect Camera requires a camera using a 2D Renderer. Some features, such as Upscale Render Texture, are not supported with other Renderers."; + public const string nonRenderer2DError = "URP Pixel Perfect Camera requires a camera using a 2D Renderer."; public GUIStyle centeredLabel; @@ -57,11 +58,23 @@ private void LazyInit() m_CurrentPixelRatioValue = new GUIContent(); } - bool UsingRenderer2D() + UniversalAdditionalCameraData GetCameraData() { PixelPerfectCamera obj = target as PixelPerfectCamera; UniversalAdditionalCameraData cameraData = null; obj?.TryGetComponent(out cameraData); + return cameraData; + } + + bool UsingSRP() + { + var cameraData = GetCameraData(); + return cameraData?.scriptableRenderer != null; + } + + bool UsingRenderer2D() + { + var cameraData = GetCameraData(); if (cameraData != null) { @@ -77,11 +90,9 @@ void CheckForCameraStacking() { m_CameraStacking = false; - PixelPerfectCamera obj = target as PixelPerfectCamera; - UniversalAdditionalCameraData cameraData = null; - obj?.TryGetComponent(out cameraData); + var cameraData = GetCameraData(); - if (cameraData == null) + if (cameraData == null || cameraData.scriptableRenderer == null) return; if (cameraData.renderType == CameraRenderType.Base) @@ -124,11 +135,16 @@ public override void OnInspectorGUI() { LazyInit(); - if (!UsingRenderer2D()) + if (!UsingSRP()) { EditorGUILayout.HelpBox(Style.nonRenderer2DError, MessageType.Error); return; } + else if (!UsingRenderer2D()) + { + EditorGUILayout.HelpBox(Style.nonRenderer2DWarning, MessageType.Warning); + EditorGUILayout.Space(); + } float originalLabelWidth = EditorGUIUtility.labelWidth; diff --git a/com.unity.render-pipelines.universal/Editor/Converter/RenderPipelineConverter.cs b/com.unity.render-pipelines.universal/Editor/Converter/RenderPipelineConverter.cs index 445fbbeaeeb..3ce8d64089f 100644 --- a/com.unity.render-pipelines.universal/Editor/Converter/RenderPipelineConverter.cs +++ b/com.unity.render-pipelines.universal/Editor/Converter/RenderPipelineConverter.cs @@ -2,6 +2,7 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("PPv2URPConverters")] +[assembly: InternalsVisibleTo("Unity.2D.PixelPerfect.Editor")] namespace UnityEditor.Rendering.Universal.Converters { // Might need to change this name before making it public