/// <summary> /// Loads a preset with the given presetName. If the preset file does not exist, nothing will happen. /// </summary> void LoadPreset(string presetName) { DefineSymbols.DefineSymbolsPreset preset = Q.GetResource <DefineSymbols.DefineSymbolsPreset>(EZT.RESOURCES_PATH_DEFINE_SYMBOLS_PRESETS, presetName); if (preset == null) { return; } if (presetSymbols == null) { presetSymbols = new List <string>(); } else { presetSymbols.Clear(); } if (preset.presetValues == null || preset.presetValues.Count == 0) { preset.presetValues = new List <string> { "" }; } presetSymbols.AddRange(preset.presetValues); loadedPresetName = presetName; selectedPresetName = loadedPresetName; }
/// <summary> /// Saves a new preset as an asset file in the DefineSymbolsPresets folder. The new preset's filename will be the preset name. /// </summary> void SavePreset(List <string> presetValues, string presetName) { presetValues = QUtils.CleanList(presetValues); DefineSymbols.DefineSymbolsPreset asset = Q.CreateAsset <DefineSymbols.DefineSymbolsPreset>(EZT.RELATIVE_PATH_DEFINE_SYMBOLS_PRESETS, presetName); asset.presetValues = new List <string>(presetValues); QUI.SetDirty(asset); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); RefreshPresetNames(); LoadPreset(presetName); }