// protected virtual void CloseWindow() { if (window == null) { return; } window.Close(); window = null; }
// public static SavePresetWindow Init(string name, InputResult callback) { Rect rect = new Rect(Screen.width * 0.5f, Screen.height * 0.5f, 300f, 60f); SavePresetWindow window = GetWindowWithRect <SavePresetWindow>(rect, true, "Specify Preset Name", true); window.callback = callback; window.presetName = name; return(window); }
// protected virtual bool SavePresetAs(string name) { name = name.Trim(); window = null; if (string.IsNullOrEmpty(name)) { EditorUtility.DisplayDialog("Unable to save Preset", "Please specify valid Preset name.", "Close"); return(false); } // Preset with this name exists? HighlightingPreset preset; if (hr.GetPreset(name, out preset)) { // Overwrite? if (!EditorUtility.DisplayDialog("Overwriting Preset", "Preset '" + name + "' already exists. Overwrite?", "Yes", "No")) { return(false); } } // Add or overwrite preset preset.name = name; preset.downsampleFactor = hr.downsampleFactor; preset.iterations = hr.iterations; preset.blurMinSpread = hr.blurMinSpread; preset.blurSpread = hr.blurSpread; preset.blurIntensity = hr.blurIntensity; preset.blurDirections = hr.blurDirections; hr.AddPreset(preset, true); EditorUtility.SetDirty(hr); InitializePresetNames(); IdentifyCurrentPreset(); return(true); }
// protected void RendererGUI() { #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY if (!PlayerSettings.use32BitDisplayBuffer) { EditorGUILayout.HelpBox("Highlighting System requires 32-bit display buffer. Set the 'Use 32-bit Display Buffer' checkbox under the 'Resolution and Presentation' section of Player Settings.", MessageType.Error); } #endif if (hb.blitter == null) { EditorGUILayout.HelpBox("Use order of this component (relatively to other Image Effects applied to this camera) to control the point at which highlighting will be applied to the framebuffer (click on a little gear icon to the right and choose Move Up / Move Down) or assign HighlightingBlitter component from the other camera.", MessageType.Info); } else if (hb.GetComponent <Camera>() == hb.blitter.GetComponent <Camera>()) { EditorGUILayout.HelpBox("Assigned HighlightingBlitter component exists on the same camera. This is not really necessary in most situations and affects rendering performance! Please make sure this is intended.", MessageType.Warning); } hb.blitter = EditorGUILayout.ObjectField("Blitter (Optional)", hb.blitter, typeof(HighlightingBlitter), true) as HighlightingBlitter; EditorGUILayout.HelpBox("Depth Offset properties should be used only when Dynamic Batching is enabled in Player Settings. Otherwise set them to 0's to avoid rendering artifacts.", MessageType.Info); EditorGUI.BeginChangeCheck(); hb.offsetFactor = EditorGUILayout.Slider("Depth Offset Factor:", hb.offsetFactor, -1f, 0f); hb.offsetUnits = EditorGUILayout.Slider("Depth Offset Units:", hb.offsetUnits, -100f, 0f); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(hb); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Preset:"); int oldIndex = presetIndex; int newIndex = EditorGUILayout.Popup(presetIndex, presetNames); if (oldIndex != newIndex) { SetPresetSettings(newIndex); presetIndex = newIndex; } Preset currentPreset = new Preset(); if (presetIndex >= 0) { currentPreset = presets[presetIndex]; } EditorGUI.BeginChangeCheck(); SetBoldDefaultFont(presetIndex < 0 || hb.downsampleFactor != currentPreset.downsampleFactor); hb.downsampleFactor = _downsampleSet[EditorGUILayout.Popup("Downsampling:", _downsampleGet[hb.downsampleFactor], downsampleOptions)]; SetBoldDefaultFont(presetIndex < 0 || hb.iterations != currentPreset.iterations); hb.iterations = Mathf.Clamp(EditorGUILayout.IntField("Iterations:", hb.iterations), 0, 50); SetBoldDefaultFont(presetIndex < 0 || hb.blurMinSpread != currentPreset.blurMinSpread); hb.blurMinSpread = EditorGUILayout.Slider("Min Spread:", hb.blurMinSpread, 0f, 3f); SetBoldDefaultFont(presetIndex < 0 || hb.blurSpread != currentPreset.blurSpread); hb.blurSpread = EditorGUILayout.Slider("Spread:", hb.blurSpread, 0f, 3f); SetBoldDefaultFont(presetIndex < 0 || hb.blurIntensity != currentPreset.blurIntensity); hb.blurIntensity = EditorGUILayout.Slider("Intensity:", hb.blurIntensity, 0f, 5f); SetBoldDefaultFont(false); if (EditorGUI.EndChangeCheck()) { // If settings have changed when default preset has been selected if (presetIndex < defaultPresets.Count) { presetIndex = -1; } EditorUtility.SetDirty(hb); } int customPresetIndex = presetIndex - defaultPresets.Count; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save Preset")) { string defaultName; if (customPresetIndex < 0) { defaultName = "My Preset"; } else { defaultName = customPresets[customPresetIndex].name; } window = SavePresetWindow.Init(defaultName, SavePresetAs); } if (presetIndex < defaultPresets.Count) { GUI.enabled = false; } if (GUILayout.Button(GUI.enabled ? removeButtonContent : removeButtonContentDisabled)) { bool delete = EditorUtility.DisplayDialog("Removing Preset", "Are you sure - you want to remove Preset '" + customPresets[customPresetIndex].name + "'?", "Yes", "No"); if (delete) { customPresets.RemoveAt(customPresetIndex); SavePresets(); LoadPresets(); SetPresetSettings(0); presetIndex = 0; } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
// protected virtual PresetSaveResult SavePresetAs(string name, bool overwrite) { window = null; if (string.IsNullOrEmpty(name)) { return(PresetSaveResult.Null); } int customPresetIndex = -1; for (int i = 0, imax = presets.Count; i < imax; i++) { if (presets[i].name == name) { if (i < defaultPresets.Count) { // Overwriting default presets is not allowed return(PresetSaveResult.Default); } else if (!overwrite) { // Preset with this name already exists return(PresetSaveResult.Exists); } else { // Overwrite custom preset with this name customPresetIndex = i - defaultPresets.Count; break; } } } Preset p = new Preset(); p.name = name; p.downsampleFactor = hb.downsampleFactor; p.iterations = hb.iterations; p.blurMinSpread = hb.blurMinSpread; p.blurSpread = hb.blurSpread; p.blurIntensity = hb.blurIntensity; int newIndex = -1; if (overwrite && customPresetIndex >= 0) { customPresets[customPresetIndex] = p; newIndex = customPresetIndex + defaultPresets.Count; } else { customPresets.Add(p); newIndex = customPresets.Count + defaultPresets.Count - 1; } SavePresets(); LoadPresets(); presetIndex = newIndex; EditorUtility.SetDirty(hb); return(PresetSaveResult.Success); }
// protected void CommonGUI() { #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY if (!PlayerSettings.use32BitDisplayBuffer) { EditorGUILayout.HelpBox("Highlighting System requires 32-bit display buffer. Set the 'Use 32-bit Display Buffer' checkbox under the 'Resolution and Presentation' section of Player Settings.", MessageType.Error); } #endif EditorGUILayout.HelpBox("Depth Offset properties should be used only when Dynamic Batching is enabled in Player Settings. Otherwise set them to 0's to avoid rendering artifacts.", MessageType.Info); hb.offsetFactor = EditorGUILayout.Slider("Depth Offset Factor:", hb.offsetFactor, -1f, 0f); hb.offsetUnits = EditorGUILayout.Slider("Depth Offset Units:", hb.offsetUnits, -100f, 0f); EditorGUILayout.Space(); EditorGUILayout.LabelField("Preset:"); int oldIndex = presetIndex; int newIndex = EditorGUILayout.Popup(presetIndex, presetNames); if (oldIndex != newIndex) { SetPresetSettings(newIndex); presetIndex = newIndex; } Preset currentPreset = new Preset(); if (presetIndex >= 0) { currentPreset = presets[presetIndex]; } EditorGUI.BeginChangeCheck(); SetBoldDefaultFont(presetIndex < 0 || hb.downsampleFactor != currentPreset.downsampleFactor); hb.downsampleFactor = _downsampleSet[EditorGUILayout.Popup("Downsampling:", _downsampleGet[hb.downsampleFactor], downsampleOptions)]; SetBoldDefaultFont(presetIndex < 0 || hb.iterations != currentPreset.iterations); hb.iterations = Mathf.Clamp(EditorGUILayout.IntField("Iterations:", hb.iterations), 0, 50); SetBoldDefaultFont(presetIndex < 0 || hb.blurMinSpread != currentPreset.blurMinSpread); hb.blurMinSpread = EditorGUILayout.Slider("Min Spread:", hb.blurMinSpread, 0f, 3f); SetBoldDefaultFont(presetIndex < 0 || hb.blurSpread != currentPreset.blurSpread); hb.blurSpread = EditorGUILayout.Slider("Spread:", hb.blurSpread, 0f, 3f); SetBoldDefaultFont(presetIndex < 0 || hb.blurIntensity != currentPreset.blurIntensity); hb.blurIntensity = EditorGUILayout.Slider("Intensity:", hb.blurIntensity, 0f, 1f); SetBoldDefaultFont(false); if (EditorGUI.EndChangeCheck()) { // If settings have changed when default preset has been selected if (presetIndex < defaultPresets.Count) { presetIndex = -1; } EditorUtility.SetDirty(hb); } int customPresetIndex = presetIndex - defaultPresets.Count; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save Preset")) { string defaultName; if (customPresetIndex < 0) { defaultName = "My Preset"; } else { defaultName = customPresets[customPresetIndex].name; } window = SavePresetWindow.Init(defaultName, SavePresetAs); } if (presetIndex < defaultPresets.Count) { GUI.enabled = false; } if (GUILayout.Button(GUI.enabled ? removeButtonContent : removeButtonContentDisabled)) { bool delete = EditorUtility.DisplayDialog("Removing Preset", "Are you sure - you want to remove Preset '" + customPresets[customPresetIndex].name + "'?", "Yes", "No"); if (delete) { customPresets.RemoveAt(customPresetIndex); SavePresets(); LoadPresets(); SetPresetSettings(0); presetIndex = 0; } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
// protected virtual PresetSaveResult SavePresetAs(string name, bool overwrite) { window = null; if (string.IsNullOrEmpty(name)) { return PresetSaveResult.Null; } int customPresetIndex = -1; for (int i = 0, imax = presets.Count; i < imax; i++) { if (presets[i].name == name) { if (i < defaultPresets.Count) { // Overwriting default presets is not allowed return PresetSaveResult.Default; } else if (!overwrite) { // Preset with this name already exists return PresetSaveResult.Exists; } else { // Overwrite custom preset with this name customPresetIndex = i - defaultPresets.Count; break; } } } Preset p = new Preset(); p.name = name; p.downsampleFactor = hb.downsampleFactor; p.iterations = hb.iterations; p.blurMinSpread = hb.blurMinSpread; p.blurSpread = hb.blurSpread; p.blurIntensity = hb.blurIntensity; int newIndex = -1; if (overwrite && customPresetIndex >= 0) { customPresets[customPresetIndex] = p; newIndex = customPresetIndex + defaultPresets.Count; } else { customPresets.Add(p); newIndex = customPresets.Count + defaultPresets.Count - 1; } SavePresets(); LoadPresets(); presetIndex = newIndex; EditorUtility.SetDirty(hb); return PresetSaveResult.Success; }
protected void CommonGUI() { #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY if (!PlayerSettings.use32BitDisplayBuffer) { EditorGUILayout.HelpBox("Highlighting System requires 32-bit display buffer. Set the 'Use 32-bit Display Buffer' checkbox under the 'Resolution and Presentation' section of Player Settings.", MessageType.Error); } #endif hb.offsetFactor = EditorGUILayout.Slider("Depth Offset Factor:", hb.offsetFactor, -1f, 0f); hb.offsetUnits = EditorGUILayout.Slider("Depth Offset Units:", hb.offsetUnits, -100f, 0f); EditorGUILayout.Space(); EditorGUILayout.LabelField("Preset:"); int oldIndex = presetIndex; int newIndex = EditorGUILayout.Popup(presetIndex, presetNames); if (oldIndex != newIndex) { SetPresetSettings(newIndex); presetIndex = newIndex; } Preset currentPreset = new Preset(); if (presetIndex >= 0) { currentPreset = presets[presetIndex]; } EditorGUI.BeginChangeCheck(); SetBoldDefaultFont(presetIndex < 0 || hb.downsampleFactor != currentPreset.downsampleFactor); hb.downsampleFactor = _downsampleSet[EditorGUILayout.Popup("Downsampling:", _downsampleGet[hb.downsampleFactor], downsampleOptions)]; SetBoldDefaultFont(presetIndex < 0 || hb.iterations != currentPreset.iterations); hb.iterations = Mathf.Clamp(EditorGUILayout.IntField("Iterations:", hb.iterations), 0, 50); SetBoldDefaultFont(presetIndex < 0 || hb.blurMinSpread != currentPreset.blurMinSpread); hb.blurMinSpread = EditorGUILayout.Slider("Min Spread:", hb.blurMinSpread, 0f, 3f); SetBoldDefaultFont(presetIndex < 0 || hb.blurSpread != currentPreset.blurSpread); hb.blurSpread = EditorGUILayout.Slider("Spread:", hb.blurSpread, 0f, 3f); SetBoldDefaultFont(presetIndex < 0 || hb.blurIntensity != currentPreset.blurIntensity); hb.blurIntensity = EditorGUILayout.Slider("Intensity:", hb.blurIntensity, 0f, 1f); SetBoldDefaultFont(false); if (EditorGUI.EndChangeCheck()) { if (presetIndex < defaultPresets.Count) { presetIndex = -1; } EditorUtility.SetDirty(hb); } int customPresetIndex = presetIndex - defaultPresets.Count; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save Preset")) { string defaultName; if (customPresetIndex < 0) { defaultName = "My Preset"; } else { defaultName = customPresets[customPresetIndex].name; } window = SavePresetWindow.Init(defaultName, SavePresetAs); } if (presetIndex < defaultPresets.Count) { GUI.enabled = false; } if (GUILayout.Button(GUI.enabled ? removeButtonContent : removeButtonContentDisabled)) { bool delete = EditorUtility.DisplayDialog("Removing Preset", "Are you sure - you want to remove Preset '" + customPresets[customPresetIndex].name + "'?", "Yes", "No"); if (delete) { customPresets.RemoveAt(customPresetIndex); SavePresets(); LoadPresets(); SetPresetSettings(0); presetIndex = 0; } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
// protected void RendererGUI() { #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY if (!PlayerSettings.use32BitDisplayBuffer) { EditorGUILayout.HelpBox("Highlighting System requires 32-bit display buffer. Set the 'Use 32-bit Display Buffer' checkbox under the 'Resolution and Presentation' section of Player Settings.", MessageType.Error); } #endif if (hb.blitter == null) { EditorGUILayout.HelpBox("Use order of this component (relatively to other Image Effects applied to this camera) to control the point at which highlighting will be applied to the framebuffer (click on a little gear icon to the right and choose Move Up / Move Down) or assign HighlightingBlitter component from the other camera.", MessageType.Info); } else if (hb.GetComponent<Camera>() == hb.blitter.GetComponent<Camera>()) { EditorGUILayout.HelpBox("Assigned HighlightingBlitter component exists on the same camera. This is not really necessary in most situations and affects rendering performance! Please make sure this is intended.", MessageType.Warning); } hb.blitter = EditorGUILayout.ObjectField("Blitter (Optional)", hb.blitter, typeof(HighlightingBlitter), true) as HighlightingBlitter; EditorGUILayout.HelpBox("Depth Offset properties should be used only when Dynamic Batching is enabled in Player Settings. Otherwise set them to 0's to avoid rendering artifacts.", MessageType.Info); EditorGUI.BeginChangeCheck(); hb.offsetFactor = EditorGUILayout.Slider("Depth Offset Factor:", hb.offsetFactor, -1f, 0f); hb.offsetUnits = EditorGUILayout.Slider("Depth Offset Units:", hb.offsetUnits, -100f, 0f); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(hb); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Preset:"); int oldIndex = presetIndex; int newIndex = EditorGUILayout.Popup(presetIndex, presetNames); if (oldIndex != newIndex) { SetPresetSettings(newIndex); presetIndex = newIndex; } Preset currentPreset = new Preset(); if (presetIndex >= 0) { currentPreset = presets[presetIndex]; } EditorGUI.BeginChangeCheck(); SetBoldDefaultFont(presetIndex < 0 || hb.downsampleFactor != currentPreset.downsampleFactor); hb.downsampleFactor = _downsampleSet[EditorGUILayout.Popup("Downsampling:", _downsampleGet[hb.downsampleFactor], downsampleOptions)]; SetBoldDefaultFont(presetIndex < 0 || hb.iterations != currentPreset.iterations); hb.iterations = Mathf.Clamp(EditorGUILayout.IntField("Iterations:", hb.iterations), 0, 50); SetBoldDefaultFont(presetIndex < 0 || hb.blurMinSpread != currentPreset.blurMinSpread); hb.blurMinSpread = EditorGUILayout.Slider("Min Spread:", hb.blurMinSpread, 0f, 3f); SetBoldDefaultFont(presetIndex < 0 || hb.blurSpread != currentPreset.blurSpread); hb.blurSpread = EditorGUILayout.Slider("Spread:", hb.blurSpread, 0f, 3f); SetBoldDefaultFont(presetIndex < 0 || hb.blurIntensity != currentPreset.blurIntensity); hb.blurIntensity = EditorGUILayout.Slider("Intensity:", hb.blurIntensity, 0f, 1f); SetBoldDefaultFont(false); if (EditorGUI.EndChangeCheck()) { // If settings have changed when default preset has been selected if (presetIndex < defaultPresets.Count) { presetIndex = -1; } EditorUtility.SetDirty(hb); } int customPresetIndex = presetIndex - defaultPresets.Count; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save Preset")) { string defaultName; if (customPresetIndex < 0) { defaultName = "My Preset"; } else { defaultName = customPresets[customPresetIndex].name; } window = SavePresetWindow.Init(defaultName, SavePresetAs); } if (presetIndex < defaultPresets.Count) { GUI.enabled = false; } if (GUILayout.Button(GUI.enabled ? removeButtonContent : removeButtonContentDisabled)) { bool delete = EditorUtility.DisplayDialog("Removing Preset", "Are you sure - you want to remove Preset '" + customPresets[customPresetIndex].name + "'?", "Yes", "No"); if (delete) { customPresets.RemoveAt(customPresetIndex); SavePresets(); LoadPresets(); SetPresetSettings(0); presetIndex = 0; } } GUI.enabled = true; EditorGUILayout.EndHorizontal(); }
// public override void OnInspectorGUI() { #if UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLACKBERRY if (!PlayerSettings.use32BitDisplayBuffer) { EditorGUILayout.HelpBox("Highlighting System requires 32-bit display buffer. Set the 'Use 32-bit Display Buffer' checkbox under the 'Resolution and Presentation' section of Player Settings.", MessageType.Error); } #endif EditorGUILayout.Space(); // HighlightingBlitter field if (hr.blitter == null) { EditorGUILayout.HelpBox("Use order of this component (relatively to other Image Effects on this camera) to control the point at which highlighting will be applied to the framebuffer (click on a little gear icon to the right and choose Move Up / Move Down) or assign HighlightingBlitter component from another camera.", MessageType.Info); } else if (hr.GetComponent <Camera>() == hr.blitter.GetComponent <Camera>()) { EditorGUILayout.HelpBox("Assigned HighlightingBlitter component exists on the same camera. This is not really necessary in most situations and affects rendering performance! Please make sure this is intended.", MessageType.Warning); } hr.blitter = EditorGUILayout.ObjectField("Blitter (Optional)", hr.blitter, typeof(HighlightingBlitter), true) as HighlightingBlitter; hr.antiAliasing = (AntiAliasing)EditorGUILayout.Popup(labelAntiAliasing, (int)hr.antiAliasing, antiAliasingOptions); InitializePresetNames(); int presetIndex = IdentifyCurrentPreset(); // Preset fields start EditorGUILayout.LabelField("Preset:"); // Preset selection popup int oldIndex = presetIndex; int newIndex = EditorGUILayout.Popup(oldIndex, presetNames); if (oldIndex != newIndex) { hr.LoadPreset(presetNames[newIndex].text); presetIndex = newIndex; } HighlightingPreset currentPreset = new HighlightingPreset(); if (presetIndex >= 0) { hr.GetPreset(presetNames[presetIndex].text, out currentPreset); } EditorGUI.BeginChangeCheck(); // Downsample factor SetBoldDefaultFont(presetIndex < 0 || hr.downsampleFactor != currentPreset.downsampleFactor); hr.downsampleFactor = HighlightingPresetEditor.downsampleSet[EditorGUILayout.Popup(HighlightingPresetEditor.labelDownsampling, HighlightingPresetEditor.downsampleGet[hr.downsampleFactor], HighlightingPresetEditor.downsampleOptions)]; // Iterations SetBoldDefaultFont(presetIndex < 0 || hr.iterations != currentPreset.iterations); hr.iterations = Mathf.Clamp(EditorGUILayout.IntField(HighlightingPresetEditor.labelIterations, hr.iterations), 0, 50); // Blur min spread SetBoldDefaultFont(presetIndex < 0 || hr.blurMinSpread != currentPreset.blurMinSpread); hr.blurMinSpread = EditorGUILayout.Slider(HighlightingPresetEditor.labelBlurMinSpread, hr.blurMinSpread, 0f, 3f); // Blur spread SetBoldDefaultFont(presetIndex < 0 || hr.blurSpread != currentPreset.blurSpread); hr.blurSpread = EditorGUILayout.Slider(HighlightingPresetEditor.labelBlurSpread, hr.blurSpread, 0f, 3f); // Blur intensity SetBoldDefaultFont(presetIndex < 0 || hr.blurIntensity != currentPreset.blurIntensity); hr.blurIntensity = EditorGUILayout.Slider(HighlightingPresetEditor.labelBlurIntensity, hr.blurIntensity, 0f, 1f); // Blur straight directions SetBoldDefaultFont(presetIndex < 0 || hr.blurDirections != currentPreset.blurDirections); hr.blurDirections = (BlurDirections)EditorGUILayout.Popup(HighlightingPresetEditor.labelBlurDirections, (int)hr.blurDirections, HighlightingPresetEditor.blurDirections); SetBoldDefaultFont(false); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(hr); } // Define button rects Rect position = GUILayoutUtility.GetRect(0f, 16f, GUILayout.ExpandWidth(true)); HighlightingRendererEditor.GetColumnRects(position, 2f, buttonRects); bool cachedEnabled; // Save preset button cachedEnabled = GUI.enabled; GUI.enabled = !Application.isPlaying || hr.downsampleFactor != currentPreset.downsampleFactor || hr.iterations != currentPreset.iterations || hr.blurMinSpread != currentPreset.blurMinSpread || hr.blurSpread != currentPreset.blurSpread || hr.blurIntensity != currentPreset.blurIntensity || hr.blurDirections != currentPreset.blurDirections; if (GUI.Button(buttonRects[0], "Save Preset")) { window = SavePresetWindow.Init(presetIndex < 0 ? "My Preset" : presetNames[presetIndex].text, SavePresetAs); } GUI.enabled = cachedEnabled; // Remove preset button cachedEnabled = GUI.enabled; GUI.enabled = !Application.isPlaying || presetIndex < 0; if (GUI.Button(buttonRects[1], labelButtonRemove) && presetIndex >= 0) { string presetName = presetNames[presetIndex].text; if (EditorUtility.DisplayDialog("Removing Preset", "Are you sure you want to remove Preset '" + presetName + "'?", "Yes", "No")) { hr.RemovePreset(presetName); EditorUtility.SetDirty(hr); ReadOnlyCollection <HighlightingPreset> presets = hr.presets; if (presets.Count > 0) { presetIndex = 0; hr.ApplyPreset(presets[presetIndex]); } InitializePresetNames(); } } GUI.enabled = cachedEnabled; EditorGUILayout.Space(); }