public static void BuildBundles() { BundleBuildHelper.PushAssetDependencies(); BuildSingleBundle(BundleName.BN_SCRIPT, null); BundleData shader = BundleDataManager.GetBundleData(BundleName.BN_SHADER); for (int i = 0; shader != null && i < shader.children.Count; ++i) { BundleData shaderChild = BundleDataManager.GetBundleData(shader.children[i]); BundleState childState = BundleDataManager.GetBundleState(shader.children[i]); bool result = BundleBuildHelper.BuildShaderBundle(shaderChild, childState); if (!result) { Debug.LogErrorFormat("[BundleAdapter] BuildShaderBundle {0} Failed.", shader.children[i]); } } List <BundleImportData> dataList = m_dataControl.DataList; for (int i = 0; i < dataList.Count; ++i) { BundleImportData data = dataList[i]; string parentName = BundleDataManager.GetIndexBundleName(i); BuildSingleBundle(parentName, data); } BundleBuildHelper.PopAssetDependencies(); BundleExport.ExportBundleMainfestToOutput(); AssetDatabase.SaveAssets(); }
private static void BuildSingleBundle(string name, BundleImportData data) { BundleData bundle = BundleDataManager.GetBundleData(name); if (bundle == null) { return; } for (int i = 0; i < bundle.children.Count; ++i) { BundleData child = BundleDataManager.GetBundleData(bundle.children[i]); BundleState childState = BundleDataManager.GetBundleState(bundle.children[i]); if (child == null || child.includs.Count == 0 || childState == null) { continue; } if (m_buildAll && !m_bundleDict.ContainsKey(child.name)) { continue; } bool result = BundleBuildHelper.BuildSingleBundle(child, childState, data == null ? false : data.PushDependice); if (!result) { Debug.LogErrorFormat("[BundleAdapter] BuildSingleBundle {0} Failed.", child.name); } } }
public static void ExportBundleMainfestToOutput() { EditorTool.CreateDirectory(BuildConfig.InterpretedOutputPath); ExportBundleDictToOutput(); string[] list = { BuildConfig.BundleMainfestOutputPath }; uint crc = 0; bool success = BundleBuildHelper.BuildAssetBundle(list, BuildConfig.MainfestOutputPath, out crc, BundleType.TextAsset); if (!success) { Debug.LogErrorFormat("[BundleExport] BuildAssetBundle {0} Failed.", BuildConfig.BundleMainfestOutputPath); } }