Exemple #1
0
        public static void DisplaySetupWarning <T>(bool state = true)
#endif
        {
#if URP && !PPS
            ScriptableRendererData[] rendererDataList = (ScriptableRendererData[])typeof(UniversalRenderPipelineAsset).GetField("m_RendererDataList", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(UniversalRenderPipeline.asset);
            int defaultRendererIndex = (int)typeof(UniversalRenderPipelineAsset).GetField("m_DefaultRendererIndex", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(UniversalRenderPipeline.asset);
            ScriptableRendererData forwardRenderer = rendererDataList[defaultRendererIndex];

            if (forwardRenderer.GetType() == typeof(Renderer2DData))
            {
                EditorGUILayout.HelpBox("2D renderer is not supported", MessageType.Error);
            }

            if (state)
            {
                return;
            }

            EditorGUILayout.HelpBox("Effect has not been added to the default renderer's\n\"Renderer Features\" list. Will not render otherwise.", MessageType.Warning);

            GUILayout.Space(-32);
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(new GUIContent("Add", EditorGUIUtility.IconContent("d_tab_next").image), GUILayout.Width(60)))
                {
                    AutoSetup.SetupEffect <T>();
                    state = true;
                }
                GUILayout.Space(8);
            }
            GUILayout.Space(11);
#endif
//Post processing feature set was removed in 2020.1, compile out in case the user imports the asset with URP+PPS in 2020.1
#if URP && PPS && !UNITY_2020_1_OR_NEWER
            if (UniversalRenderPipeline.asset && UniversalRenderPipeline.asset.postProcessingFeatureSet == PostProcessingFeatureSet.Integrated)
            {
                EditorGUILayout.HelpBox("Post Processing Stack v2 installed, but URP isn't configured to use it", MessageType.Error);

                GUILayout.Space(-32);
                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(new GUIContent("Fix", EditorGUIUtility.IconContent("d_tab_next").image), GUILayout.Width(60)))
                    {
                        UniversalRenderPipeline.asset.postProcessingFeatureSet = PostProcessingFeatureSet.PostProcessingV2;
                    }
                    GUILayout.Space(8);
                }
                GUILayout.Space(11);
            }
#endif
#if URP && PPS && UNITY_2020_1_OR_NEWER
            EditorGUILayout.HelpBox("Post Processing package and URP no longer work together since Unity 2020.1+.\n\nUninstall the Post-processing package and re-run the SC Post Effects installer. See documentation", MessageType.Error);
#endif
#if !URP && PPS
            //Nothing
#endif
        }
Exemple #2
0
        public static void DisplaySetupWarning()
#endif
        {
#if URP && PPS
            if (UniversalRenderPipeline.asset && UniversalRenderPipeline.asset.postProcessingFeatureSet == PostProcessingFeatureSet.Integrated)
            {
                EditorGUILayout.HelpBox("Post Processing Stack v2 installed, but URP isn't configured to use it", MessageType.Error);

                GUILayout.Space(-32);
                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(new GUIContent("Fix", EditorGUIUtility.IconContent("d_tab_next").image), GUILayout.Width(60)))
                    {
                        UniversalRenderPipeline.asset.postProcessingFeatureSet = PostProcessingFeatureSet.PostProcessingV2;
                    }
                    GUILayout.Space(8);
                }
                GUILayout.Space(11);
            }
#endif

#if URP && !PPS
            if (state)
            {
                return;
            }

            EditorGUILayout.HelpBox("Effect has not been added to the Forward renderer's\n\"Renderer Features\" list. Will not render otherwise.", MessageType.Warning);

            GUILayout.Space(-32);
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button(new GUIContent("Add", EditorGUIUtility.IconContent("d_tab_next").image), GUILayout.Width(60)))
                {
                    AutoSetup.SetupEffect <T>();
                    state = true;
                }
                GUILayout.Space(8);
            }
            GUILayout.Space(11);
#endif
        }