void OnGUI() { settings = EditorGUILayout.ObjectField("Settings", settings, typeof(GSPluginSettings), false) as GSPluginSettings; scrollPosition = GUILayout.BeginScrollView(scrollPosition); if (settings != null) { // セットされている settings 情報を EditorUserSettings に保存する. { string guid; long localId; if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(settings, out guid, out localId)) { if (savedGUID != guid) { // Debug.Log("Save GUID(" + guid + ") at " + SETTINGS_KEY); EditorPrefs.SetString(SETTINGS_KEY, guid); EditorUserSettings.SetConfigValue(SETTINGS_KEY, guid); savedGUID = guid; } } } for (int i = 0; i < settings.sheets.Length; i++) { var sheet = settings.sheets[i]; GUILayout.BeginHorizontal("box"); GUILayout.Label(sheet.targetPath); if (GUILayout.Button("Download", GUILayout.Width(80)) && !isDownloading) { isDownloading = true; DownloadOne(sheet); isDownloading = false; GUIUtility.ExitGUI(); } GUILayout.EndHorizontal(); } if (GUILayout.Button("DownloadAll", "LargeButtonMid") && !isDownloading) { isDownloading = true; var sheets = new List <GSPluginSettings.Sheet>(settings.sheets); DownloadAll(sheets); isDownloading = false; GUIUtility.ExitGUI(); } } GUILayout.EndScrollView(); }
void OnEnable() { string guid = EditorUserSettings.GetConfigValue(SETTINGS_KEY); string path = AssetDatabase.GUIDToAssetPath(guid); if (path != "") { // Debug.Log("Found prefs settings GUID: " + EditorPrefs.GetString(SETTINGS_KEY)); settings = AssetDatabase.LoadAssetAtPath <GSPluginSettings>(path); // string[] settingGUIDArray = AssetDatabase.FindAssets("t:GSPluginSettings"); } else { // Debug.Log("Not Found GUID"); } // foreach (string guid in settingGUIDArray) { // string path = AssetDatabase.GUIDToAssetPath(guid); // settings = AssetDatabase.LoadAssetAtPath<GSPluginSettings>(path); // } }
public static void Create() { GSPluginSettings o = ScriptableObject.CreateInstance <GSPluginSettings>(); create <GSPluginSettings>(o); }