// private static T[] GetAllInstances<T>() where T : ScriptableObject // { // var assets = AssetDatabase.FindAssets("t:" + typeof(T).Name); // var resultAssets = new T[assets.Length]; // for (var i = 0; i < assets.Length; i++) // { // var path = AssetDatabase.GUIDToAssetPath(assets[i]); // resultAssets[i] = AssetDatabase.LoadAssetAtPath<T>(path); // } // // return resultAssets; // } #endregion #region Render private void OnEnable() { if (_currentWindow == null) { var type = Type.GetType("UnityEditor.ProjectBrowser,UnityEditor.dll"); _currentWindow = GetWindow <OpenLoaderWindow>(type); } if (_settings == null) { _settings = OpenLoaderSettings.Load(); _currentWindow.CurrentAccount = _settings.SavedAccounts.Count > 0 ? _settings.SavedAccounts[0] : null; _accounts = _settings.savedAccounts; } if (_icon != null || _currentWindow == null) { return; } _icon = EditorGUIUtility.Load( $"Assets/Editor/OpenLoader/OpenLoaderIcon{(EditorGUIUtility.isProSkin ? "_d" : "")}.png" ) as Texture2D; _currentWindow.titleContent = new GUIContent { text = "OpenLoader", image = _icon }; }
private void OnFocus() { if (_settings == null) { _settings = OpenLoaderSettings.Load(); CurrentAccount = _settings.SavedAccounts.Count > 0 ? _settings.SavedAccounts[0] : null; } }
public static void ShowWindow() { if (_icon == null) { _icon = EditorGUIUtility.Load( $"Assets/Editor/OpenLoader/OpenLoaderIcon{(EditorGUIUtility.isProSkin ? "_d" : "")}.png" ) as Texture2D; } if (_currentWindow == null) { var type = Type.GetType("UnityEditor.ProjectBrowser,UnityEditor.dll"); _currentWindow = GetWindow <OpenLoaderWindow>(type); _currentWindow.titleContent = new GUIContent { text = "OpenLoader", image = _icon }; if (_settings == null) { _settings = OpenLoaderSettings.Load(); _currentWindow.CurrentAccount = _settings.SavedAccounts.Count > 0 ? _settings.SavedAccounts[0] : null; } _currentWindow.Show(); // _currentWindow.maximized = true; } else { if (_settings == null) { _settings = OpenLoaderSettings.Load(); _currentWindow.CurrentAccount = _settings.SavedAccounts.Count > 0 ? _settings.SavedAccounts[0] : null; } _currentWindow.Show(); // _currentWindow.maximized = true; } }