public override void OnInspectorGUI()
        {
            PropertyField(m_MaxShadowDistance, EditorGUIUtility.TrTextContent("Max Distance"));
            Rect firstLine = GUILayoutUtility.GetLastRect();

            EditorGUILayout.Space();
            PropertyField(m_CascadeShadowSplitCount, EditorGUIUtility.TrTextContent("Cascade Count"));

            if (!m_CascadeShadowSplitCount.value.hasMultipleDifferentValues)
            {
                EditorGUI.indentLevel++;
                int cascadeCount = m_CascadeShadowSplitCount.value.intValue;
                for (int i = 0; i < cascadeCount - 1; i++)
                {
                    PropertyField(m_CascadeShadowSplits[i], EditorGUIUtility.TrTextContent(string.Format("Split {0}", i + 1)));
                }

                if (LightLoop.s_UseCascadeBorders)
                {
                    EditorGUILayout.Space();

                    for (int i = 0; i < cascadeCount; i++)
                    {
                        PropertyField(m_CascadeShadowBorders[i], EditorGUIUtility.TrTextContent(string.Format("Border {0}", i + 1)));
                    }
                }

                EditorGUILayout.Space();

                GUILayout.Label("Cascade splits");
                Rect rect = GUILayoutUtility.GetLastRect();
                rect.x    += rect.width - 100;
                rect.width = 60f;
                EditorGUI.LabelField(rect, EditorGUIUtility.TrTextContent("Unit"));
                rect.x    += 25;
                rect.width = 75;
                s_Unit     = (Unit)EditorGUI.EnumPopup(rect, s_Unit);
                ShadowCascadeGUI.DrawCascadeSplitGUI(m_CascadeShadowSplits, LightLoop.s_UseCascadeBorders ? m_CascadeShadowBorders : null, (uint)cascadeCount, blendLastCascade: true, useMetric: s_Unit == Unit.Metric, baseMetric: m_MaxShadowDistance.value.floatValue);
                EditorGUI.indentLevel--;
            }

            HDRenderPipeline hdrp = UnityEngine.Rendering.RenderPipelineManager.currentPipeline as HDRenderPipeline;

            if (hdrp == null)
            {
                return;
            }

            firstLine.y      -= EditorGUIUtility.singleLineHeight;
            firstLine.height -= 2;
            firstLine.x      += EditorGUIUtility.labelWidth + 20;
            firstLine.width  -= EditorGUIUtility.labelWidth + 20;
            bool currentCascadeValue = hdrp.showCascade;
            bool newCascadeValue     = GUI.Toggle(firstLine, currentCascadeValue, EditorGUIUtility.TrTextContent("Visualize Cascades"), EditorStyles.miniButton);

            if (currentCascadeValue ^ newCascadeValue)
            {
                hdrp.showCascade = newCascadeValue;
            }
        }
        public override void OnInspectorGUI()
        {
            PropertyField(m_MaxShadowDistance, EditorGUIUtility.TrTextContent("Max Distance", "In Meter"));
            Rect firstLine = GUILayoutUtility.GetLastRect();

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Directional Light");

            Rect shiftedRect = EditorGUILayout.GetControlRect();

            shiftedRect.x     += 20;
            shiftedRect.width -= 20;
            EditorGUI.BeginChangeCheck();
            Unit unit = (Unit)EditorGUI.EnumPopup(shiftedRect, EditorGUIUtility.TrTextContent("Working Unit", "Except Max Distance which will be still in meter"), m_State.value);

            if (EditorGUI.EndChangeCheck())
            {
                m_State.value = unit;
                (serializedObject.targetObject as HDShadowSettings).InitNormalized(m_State.value == Unit.Percent);
            }

            PropertyField(m_DirectionalTransmissionMultiplier, EditorGUIUtility.TrTextContent("Transmission  Multiplier"));

            EditorGUI.BeginChangeCheck();
            PropertyField(m_CascadeShadowSplitCount, EditorGUIUtility.TrTextContent("Cascade Count"));
            if (EditorGUI.EndChangeCheck())
            {
                //fix newly activated cascade split not respecting ordering
                for (int i = 1; i < m_CascadeShadowSplitCount.value.intValue - 1; i++)
                {
                    if (m_CascadeShadowSplits[i - 1].value.floatValue > m_CascadeShadowSplits[i].value.floatValue)
                    {
                        m_CascadeShadowSplits[i].value.floatValue = m_CascadeShadowSplits[i - 1].value.floatValue;
                    }
                }
            }

            if (!m_CascadeShadowSplitCount.value.hasMultipleDifferentValues)
            {
                EditorGUI.indentLevel++;
                int cascadeCount = m_CascadeShadowSplitCount.value.intValue;
                for (int i = 0; i < cascadeCount - 1; i++)
                {
                    PropertyField(m_CascadeShadowSplits[i], EditorGUIUtility.TrTextContent(string.Format("Split {0}", i + 1)));
                }

                if (HDRenderPipeline.s_UseCascadeBorders)
                {
                    EditorGUILayout.Space();

                    for (int i = 0; i < cascadeCount; i++)
                    {
                        PropertyField(m_CascadeShadowBorders[i], EditorGUIUtility.TrTextContent(string.Format("Border {0}", i + 1)));
                    }
                }

                EditorGUILayout.Space();

                GUILayout.Label("Cascade splits");
                ShadowCascadeGUI.DrawCascadeSplitGUI(m_CascadeShadowSplits, HDRenderPipeline.s_UseCascadeBorders ? m_CascadeShadowBorders : null, (uint)cascadeCount, blendLastCascade: true, useMetric: unit == Unit.Metric, baseMetric: m_MaxShadowDistance.value.floatValue);
                EditorGUI.indentLevel--;
            }

            HDRenderPipeline hdrp = UnityEngine.Rendering.RenderPipelineManager.currentPipeline as HDRenderPipeline;

            if (hdrp == null)
            {
                return;
            }

            Rect visualizeCascade = firstLine;

            visualizeCascade.y      -= (EditorGUIUtility.singleLineHeight - 2);
            visualizeCascade.height -= 2;
            visualizeCascade.x      += EditorGUIUtility.labelWidth + 20;
            visualizeCascade.width  -= EditorGUIUtility.labelWidth + 20;
            bool currentCascadeValue = hdrp.showCascade;
            bool newCascadeValue     = GUI.Toggle(visualizeCascade, currentCascadeValue, EditorGUIUtility.TrTextContent("Visualize Cascades"), EditorStyles.miniButton);

            if (currentCascadeValue ^ newCascadeValue)
            {
                hdrp.showCascade = newCascadeValue;
            }
        }