public static T Get() { #if UNITY_EDITOR if (settingsInstance != null) { return(settingsInstance); } T tempInstance = CreateInstance <T>(); if (tempInstance is RuntimeProjectSettings <T> settings) { string path = settings.SettingsPath; if (!File.Exists(path)) { settingsInstance = CreateInstance <T>(); ProjectSettingsHelper.Save(settingsInstance, path); } else { settingsInstance = ProjectSettingsHelper.Load <T>(path); } settingsInstance.hideFlags = HideFlags.HideAndDontSave; return(settingsInstance); } Debug.LogError($"{typeof(T)} does not inherit from RuntimeProjectSettings!"); return(null); #else return(settingsInstance); #endif }
public void EditorSave() { ProjectSettingsHelper.Save(settingsInstance, SettingsPath); }