public void OnEnable() { PackageCollection.InitInstance(ref Collection); PackageSearchFilter.InitInstance(ref SearchFilter); this.GetRootVisualContainer().AddStyleSheetPath(EditorGUIUtility.isProSkin ? DarkStylePath : LightStylePath); var windowResource = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(TemplatePath); if (windowResource != null) { var template = windowResource.CloneTree(null); this.GetRootVisualContainer().Add(template); template.StretchToParentSize(); PackageList.OnSelected += OnPackageSelected; PackageList.OnLoaded += OnPackagesLoaded; PackageList.OnFocusChange += OnListFocusChange; PackageManagerToolbar.SearchToolbar.OnSearchChange += OnSearchChange; PackageManagerToolbar.SearchToolbar.OnFocusChange += OnToolbarFocusChange; // Disable filter while fetching first results if (!PackageCollection.Instance.LatestListPackages.Any()) { PackageManagerToolbar.SetEnabled(false); } else { PackageList.SelectLastSelection(); } } }