protected override void OnSaveSettings(TData data, bool force) { if (data == null) { throw new ArgumentNullException(nameof(data)); } if (HasExternalPath) { CustomSettingsUtility.CheckAndCreateDirectory(AssetPath); EditorYamlUtility.ToYamlAtPath(data, AssetPath); } else { if (Exists()) { EditorUtility.SetDirty(data); } else { CustomSettingsUtility.CheckAndCreateDirectory(AssetPath); AssetDatabase.CreateAsset(data, AssetPath); AssetDatabase.ImportAsset(AssetPath); } if (force) { AssetDatabase.SaveAssets(); } } }
public void Initialise() { #if UNITY_EDITOR //Save this by default when first created CustomSettingsUtility.SaveInstance(this); #endif OnInitialise(); }
public void Save() { CustomSettingsUtility.SaveInstance(this); }