/// <summary> /// 加载配置文件 /// </summary> private static void LoadCollectSettingData() { var assetbundlecollectsettingfolderpath = Application.dataPath + AssetBundleCollectSettingSaveFolderRelativePath; if (!Directory.Exists(assetbundlecollectsettingfolderpath)) { Directory.CreateDirectory(assetbundlecollectsettingfolderpath); } var assetbundlecollectsetting = AssetDatabase.LoadAssetAtPath <AssetBundleCollectSetting>(AssetBundleCollectSettingFileRelativePath); if (assetbundlecollectsetting == null) { assetbundlecollectsetting = new AssetBundleCollectSetting(); AssetDatabase.CreateAsset(assetbundlecollectsetting, AssetBundleCollectSettingFileRelativePath); AssetDatabase.SaveAssets(); } mCollectSetting = assetbundlecollectsetting; CheckCollectorSettingValidation(); }
/// <summary> /// 加载配置文件 /// </summary> private static void LoadSettingData() { // 加载配置文件 mSetting = AssetDatabase.LoadAssetAtPath <AssetBundleCollectSetting>(AssetBundleCollectSettingFileRelativePath); if (mSetting == null) { Debug.LogWarning($"Create new {nameof(AssetBundleCollectSetting)}.asset : {AssetBundleCollectSettingFileRelativePath}"); mSetting = ScriptableObject.CreateInstance <AssetBundleCollectSetting>(); var assetbundlecollectsettingfolderpath = Application.dataPath + AssetBundleCollectSettingSaveFolderRelativePath; Utilities.CheckAndCreateSpecificFolder(assetbundlecollectsettingfolderpath); AssetDatabase.CreateAsset(Setting, AssetBundleCollectSettingFileRelativePath); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); } else { Debug.Log($"Load {nameof(AssetBundleCollectSetting)}.asset ok"); } // 清空缓存集合 _cacheTypes.Clear(); _cacheCollector.Clear(); // 获取所有资源收集器类型 List <Type> types = new List <Type>(); types.Add(typeof(LabelNone)); types.Add(typeof(LabelByFilePath)); types.Add(typeof(LabelByFolderPath)); types.Add(typeof(LableByConstName)); for (int i = 0; i < types.Count; i++) { Type type = types[i]; if (_cacheTypes.ContainsKey(type.Name) == false) { _cacheTypes.Add(type.Name, type); } } CheckCollectorSettingValidation(); }