public static void LoadPackages() { if (Application.isPlaying || _loaded) { return; } EditorApplication.update -= EditorApplication_Update; EditorApplication.update += EditorApplication_Update; _loaded = true; UIPackage.RemoveAllPackages(); FontManager.Clear(); NTexture.DisposeEmpty(); UIObjectFactory.Clear(); string[] ids = AssetDatabase.FindAssets("_fui t:textAsset"); int cnt = ids.Length; for (int i = 0; i < cnt; i++) { string assetPath = AssetDatabase.GUIDToAssetPath(ids[i]); int pos = assetPath.LastIndexOf("_fui"); if (pos == -1) { continue; } assetPath = assetPath.Substring(0, pos); if (AssetDatabase.AssetPathToGUID(assetPath) != null) { UIPackage.AddPackage(assetPath, (string name, string extension, System.Type type, out DestroyMethod destroyMethod) => { destroyMethod = DestroyMethod.Unload; return(AssetDatabase.LoadAssetAtPath(name + extension, type)); } ); } } List <UIPackage> pkgs = UIPackage.GetPackages(); pkgs.Sort(CompareUIPackage); cnt = pkgs.Count; packagesPopupContents = new GUIContent[cnt + 1]; for (int i = 0; i < cnt; i++) { packagesPopupContents[i] = new GUIContent(pkgs[i].name); } packagesPopupContents[cnt] = new GUIContent("Please Select"); EMRenderSupport.Reload(); }