private void InitPreview()
 {
     previewMode              = (CCEditorUtility.TextureDrawMode)EditorPrefs.GetInt("CCGradientEditor.previewMode");
     previewFrom              = EditorPrefs.GetFloat("CCGradientEditor.previewFrom");
     previewTo                = EditorPrefs.GetFloat("CCGradientEditor.previewTo", 1f);
     previewTexture           = new Texture2D(1, 1);
     previewTexture.hideFlags = HideFlags.HideAndDontSave;
     thumbTexture             = new Texture2D(40, 1);
     thumbTexture.hideFlags   = HideFlags.HideAndDontSave;
 }
    public override void OnPreviewSettings()
    {
        GUILayout.Label("from");
        float oldValue = previewFrom;

        previewFrom = EditorGUILayout.FloatField(previewFrom, GUILayout.MaxWidth(30f));
        if (previewFrom != oldValue)
        {
            EditorPrefs.SetFloat("CCGradientEditor.previewFrom", previewFrom);
        }
        GUILayout.Label("to");
        oldValue  = previewTo;
        previewTo = EditorGUILayout.FloatField(previewTo, GUILayout.MaxWidth(30f));
        if (previewTo != oldValue)
        {
            EditorPrefs.SetFloat("CCGradientEditor.previewTo", previewTo);
        }
        CCEditorUtility.TextureDrawMode oldMode = previewMode;
        previewMode = (CCEditorUtility.TextureDrawMode)EditorGUILayout.EnumPopup(previewMode, GUILayout.MaxWidth(50f));
        if (previewMode != oldMode)
        {
            EditorPrefs.SetInt("CCGradientEditor.previewMode", (int)previewMode);
        }
    }