static void Initialize() { LSFSettings settings = Resources.Load <LSFSettings>(SETTINGS_NAME); #if UNITY_EDITOR if (settings == null) { if (Application.isPlaying == false) { settings = ScriptableObject.CreateInstance <LSFSettings>(); if (!System.IO.Directory.Exists(Application.dataPath + "/Resources")) { AssetDatabase.CreateFolder("Assets", "Resources"); } AssetDatabase.CreateAsset(settings, "Assets/Resources/" + SETTINGS_NAME + ".asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); Debug.Log("Successfuly created new settings file."); } else { } } #endif MainSettings = settings; if (MainSettings == null) { settings = Resources.Load <LSFSettings>(DEFAULT_SETTINGS_NAME); Debug.Log("No settings found. Loading default settings."); } }
static LSFSettingsManager() { LSFSettings settings = Resources.Load <LSFSettings> (SETTINGS_NAME); #if UNITY_EDITOR if (Application.isPlaying == false) { if (settings == null) { settings = ScriptableObject.CreateInstance <LSFSettings> (); if (!System.IO.Directory.Exists(Application.dataPath + "/Resources")) { AssetDatabase.CreateFolder("Assets", "Resources"); } AssetDatabase.CreateAsset(settings, "Assets/Resources/" + SETTINGS_NAME + ".asset"); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } } #endif MainSettings = settings; if (MainSettings == null) { throw new System.NullReferenceException("No LockstepFrameworkSettings detected. Make sure there is one in the root directory of a Resources folder"); } }
static LSFSettingsManager() { LSFSettings settings = Resources.Load<LSFSettings> (SETTINGS_NAME); #if UNITY_EDITOR if (Application.isPlaying == false) { if (settings == null) { settings = ScriptableObject.CreateInstance <LSFSettings> (); if (!System.IO.Directory.Exists(Application.dataPath + "/Resources")) AssetDatabase.CreateFolder ("Assets","Resources"); AssetDatabase.CreateAsset (settings,"Assets/Resources/" + SETTINGS_NAME); AssetDatabase.SaveAssets(); AssetDatabase.Refresh (); } } #endif MainSettings = settings; if (MainSettings == null) { throw new System.NullReferenceException ("No LockstepFrameworkSettings detected. Make sure there is one in the root directory of a Resources folder"); } }