private void OnEnable()
        {
            Undo.undoRedoPerformed += OnUndoRedo;
            instance = (GRampMaker)target;
            instance.Internal_UpdateFalloffTexture();

            previewPropertyBlock = new MaterialPropertyBlock();
            GCommon.RegisterBeginRender(OnCameraRender);
            GCommon.RegisterBeginRenderSRP(OnCameraRenderSRP);
        }
        public override void OnInspectorGUI()
        {
            instance.SplineCreator = EditorGUILayout.ObjectField("Spline Creator", instance.SplineCreator, typeof(GSplineCreator), true) as GSplineCreator;
            if (instance.SplineCreator == null)
            {
                return;
            }
            bool wideMode = EditorGUIUtility.wideMode;

            EditorGUIUtility.wideMode = true;
            EditorGUI.BeginChangeCheck();
            instance.Falloff = EditorGUILayout.CurveField("Falloff", instance.Falloff, Color.red, new Rect(0, 0, 1, 1));
            if (EditorGUI.EndChangeCheck())
            {
                instance.Internal_UpdateFalloffTexture();
            }
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Falloff Noise");
            instance.FalloffNoise = EditorGUILayout.ObjectField(instance.FalloffNoise, typeof(Texture2D), false) as Texture2D;
            EditorGUILayout.EndHorizontal();
            if (instance.FalloffNoise != null)
            {
                instance.FalloffNoiseSize = EditorGUILayout.Vector2Field("Falloff Noise Size", instance.FalloffNoiseSize);
            }

            instance.AdditionalMeshResolution = EditorGUILayout.IntField("Additional Mesh Resolution", instance.AdditionalMeshResolution);
            instance.HeightOffset             = EditorGUILayout.FloatField("Height Offset", instance.HeightOffset);
            instance.StepCount              = EditorGUILayout.IntField("Step Count", instance.StepCount);
            instance.RaiseHeight            = EditorGUILayout.Toggle("Raise Height", instance.RaiseHeight);
            instance.LowerHeight            = EditorGUILayout.Toggle("Lower Height", instance.LowerHeight);
            instance.Editor_ShowLivePreview = EditorGUILayout.Toggle("Live Preview", instance.Editor_ShowLivePreview);
            EditorGUIUtility.wideMode       = wideMode;

            EditorGUILayout.Space();
            if (GUILayout.Button("Apply"))
            {
                GAnalytics.Record(GAnalytics.SPLINE_RAMP_MAKER);
                CreateInitialBackup();
                ApplyRamp();
                CreateBackupAfterApplyRamp();
            }
        }