private void DrawPresetsSaveInspector() { // Don't allow saving presets if multiobject editing. if (!serializedObject.isEditingMultipleObjects) { PresetName = EditorGUILayout.TextField("Name", PresetName); if (PresetsManager.IsPresetExists(PresetName)) { if (GUILayout.Button("Update")) { if (!string.IsNullOrEmpty(PresetName)) { PresetsManager.SavePreset(PresetName, (QuickPolygon)targets[0]); PresetName = ""; GUI.FocusControl(null); } } } else { if (GUILayout.Button("Save")) { if (!string.IsNullOrEmpty(PresetName) && PresetName != "None") { PresetsManager.SavePreset(PresetName, (QuickPolygon)targets[0]); PresetName = ""; GUI.FocusControl(null); } } } if (!string.IsNullOrEmpty(((QuickPolygon)targets[0]).CurrentPresetName) && ((QuickPolygon)targets[0]).CurrentPresetName != "None" && PresetsManager.IsPresetExists(((QuickPolygon)targets[0]).CurrentPresetName)) { EditorGUILayout.LabelField("Selected", ((QuickPolygon)targets[0]).CurrentPresetName); if (GUILayout.Button("Update")) { if (!string.IsNullOrEmpty(((QuickPolygon)targets[0]).CurrentPresetName)) { PresetsManager.SavePreset(((QuickPolygon)targets[0]).CurrentPresetName, (QuickPolygon)targets[0]); GUI.FocusControl(null); } } } } else { EditorGUILayout.HelpBox(MSG.Warnings.PRESET_MULTIOBJECT_SAVING_DISABLED, MessageType.Info); } }
public void SaveAsPreset(string name) { CurrentPresetName = name; PresetsManager.SavePreset(CurrentPresetName, this); }