/// <summary> /// 同步场景资源配置 /// </summary> static void SyncSceneAssetConfig(AssetBundleBuildData.SceneBuild.Element element, ResourcesManifestData data , bool is_write) { string localPath = EditorCommon.AbsoluteToRelativePath(element.ScenePath); localPath = localPath.ToLower(); // 场景文件与配置文件 string[] files = new string[] { localPath, SceneConfig.GetSceneConfigPath(localPath).ToLower() }; foreach (var path in files) { string key = EditorCommon.ConvertToAssetBundleName(path); ResourcesManifestData.AssetBundle ab_data; if (data.AssetBundles.TryGetValue(key, out ab_data)) { if (is_write) { ab_data.IsCompress = element.IsCompress; ab_data.IsNative = element.IsNative; ab_data.IsPermanent = false; ab_data.IsStartupLoad = false; } else { element.IsCompress = ab_data.IsCompress; element.IsNative = ab_data.IsNative; } } } }
/// <summary> /// 设置AssetBundleName /// </summary> public static void SetAssetBundleName(string full_name) { full_name = EditorCommon.AbsoluteToRelativePath(full_name); AssetImporter importer = AssetImporter.GetAtPath(full_name); if (importer != null) { string str = EditorCommon.ConvertToAssetBundleName(full_name.ToLower()); importer.assetBundleName = str; importer.assetBundleVariant = ""; importer.SaveAndReimport(); } }
/// <summary> /// 同步资源配置 /// </summary> static void SyncAssetConfig(string path, AssetBundleBuildData.AssetBuild.Element element, ResourcesManifestData data , bool is_write) { if (element.Rule == (int)emAssetBundleNameRule.Ignore) { return; } string key = EditorCommon.ConvertToAssetBundleName(path); ResourcesManifestData.AssetBundle ab_data; if (data.AssetBundles.TryGetValue(key, out ab_data)) { if (is_write) { ab_data.IsCompress = element.IsCompress; ab_data.IsNative = element.IsNative; ab_data.IsPermanent = element.IsPermanent; ab_data.IsStartupLoad = element.IsStartupLoad; } else { element.IsCompress = ab_data.IsCompress; element.IsNative = ab_data.IsNative; element.IsPermanent = ab_data.IsPermanent; element.IsStartupLoad = ab_data.IsStartupLoad; } } if (element.Children != null && element.Children.Count > 0) { foreach (var child in element.Children) { string child_path = path + "/" + child.Name.ToLower(); SyncAssetConfig(child_path, child, data, is_write); } } }
/// <summary> /// 同步场景资源配置 /// </summary> static void SyncSceneAssetConfig(AssetBundleBuildData.SceneBuild.Element element, ResourcesManifestData data , bool is_write) { string path = element.ScenePath.ToLower(); string key = EditorCommon.ConvertToAssetBundleName(path); ResourcesManifestData.AssetBundle ab_data; if (data.AssetBundles.TryGetValue(key, out ab_data)) { if (is_write) { ab_data.IsCompress = element.IsCompress; ab_data.IsNative = element.IsNative; ab_data.IsPermanent = false; ab_data.IsStartupLoad = false; } else { element.IsCompress = ab_data.IsCompress; element.IsNative = ab_data.IsNative; } } }