private void Awake() { bodyHitsPerCurve = new Dictionary <int, List <BodyHitUI> >(); // Don't allow Play Mode when this script is in the scene if (EditorApplication.isPlaying) { EditorApplication.isPlaying = false; } hapticSettings = ScriptableHapticSettings.GetSettings(); }
public static ScriptableHapticSettings GetSettings() { ScriptableHapticSettings settings = Resources.Load(DEFAULT_SETTING_NAME) as ScriptableHapticSettings; // If there is no settings, create one with the default values if (settings == null) { settings = ScriptableObject.CreateInstance <ScriptableHapticSettings>(); #if UNITY_EDITOR ScriptableObjectUtility.SaveScriptableObject(settings, DEFAULT_SETTING_LOCATION, DEFAULT_SETTING_NAME); #endif } return(settings); }
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(); }
private void GetMostRecentSettings() { persistentSettingsData = ScriptableHapticSettings.GetSettings(); temporarySettingsData = persistentSettingsData; }