private void Setup() { Instance = this; _foldoutDic = new Dictionary <ResGroup, bool>(); var resGroups = Enum.GetValues(typeof(ResGroup)); foreach (ResGroup flag in resGroups) { _foldoutDic.Add(flag, EditorPrefs.GetBool("ABFoldOut_" + flag, false)); } _bundleNameGroups = new Dictionary <ResGroup, List <string> >(); var resGroupEnums = Enum.GetValues(typeof(ResGroup)); foreach (ResGroup resGroup in resGroupEnums) { _bundleNameGroups.Add(resGroup, new List <string>()); } string configPath = GetPoolConfigPath(); if (FileHelper.IsExist(configPath)) { _poolConfig = FileHelper.ReadJsonFile <PrefabPoolConfig>(GetPoolConfigPath()); } if (_poolConfig == null) { _poolConfig = new PrefabPoolConfig(); } var allBundleNames = AssetDatabase.GetAllAssetBundleNames(); //筛选出符合的BundleName加入列表中 foreach (string bundleName in allBundleNames) { var resGroup = ResConfig.GetResGroupFromBundleName(bundleName); if (resGroup == ResGroup.Audio || resGroup == ResGroup.Effect || resGroup == ResGroup.UIPrefab) { _bundleNameGroups[resGroup].Add(bundleName); } else if (resGroup == ResGroup.Model) { if (!bundleName.StartsWith("anim_") && !bundleName.EndsWith("_mat")) { _bundleNameGroups[resGroup].Add(bundleName); } } } _bundleNameGroups[ResGroup.None].Add("Default"); }
private void OnDestroy() { Instance = null; SavePoolConfig(); }