/// <summary> /// Removes a specific curve from the pattern. If the curve is temporary, it will delete the /// associated .asset file as well. /// </summary> /// <param name="curveIndex">The index of the curve to remove in the curveList</param> public void RemoveCurve(int curveIndex) { if (curveIndex < 0 || curveIndex >= curveList.Count) { return; } #if UNITY_EDITOR // If it is a temporary curve, delete the asset first since it is no longer needed if (curveList[curveIndex].temporaryCurve) { ScriptableObjectUtility.DeleteScriptableObject(curveList[curveIndex]); } #endif curveList.RemoveAt(curveIndex); }
private void OnGUI() { EditorGUILayout.BeginVertical(); // Prompt for default save location for patterns temporarySettingsData.defaultPatternSaveLocation = EditorGUILayout.DelayedTextField("Pattern Save Location", temporarySettingsData.defaultPatternSaveLocation); // Prompt for default save location for curves temporarySettingsData.defaultCurveSaveLocation = EditorGUILayout.DelayedTextField("Curve Save Location", temporarySettingsData.defaultCurveSaveLocation); // Prompt for time granularity temporarySettingsData.defaultTimeGranularity = EditorGUILayout.FloatField("Time Granularity", temporarySettingsData.defaultTimeGranularity); // Prompt for default intensity temporarySettingsData.defaultIntensity = EditorGUILayout.FloatField("Default Intensity", temporarySettingsData.defaultIntensity); // Prompt for curve granularity temporarySettingsData.defaultCurveRenderingGranularity = EditorGUILayout.IntField("Curve Granularity", temporarySettingsData.defaultCurveRenderingGranularity); EditorGUILayout.BeginHorizontal(); // Reset to default if (GUILayout.Button("Reset to Default")) { // Delete the scriptable object, it will be recreated next time it is accessed with the default settings ScriptableObjectUtility.DeleteScriptableObject(persistentSettingsData); GetMostRecentSettings(); } // Save Settings if (GUILayout.Button("Save Settings")) { temporarySettingsData.OnValidate(); persistentSettingsData = temporarySettingsData; } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }