private static bool BuildSingleBundle(BundleData bundle) { var extra = bundle.GetExtraData(); // Prepare bundle output dictionary string outputPath = GenerateOutputPathForBundle(bundle.name); string bundleStoreDir = Path.GetDirectoryName(outputPath); if (!Directory.Exists(bundleStoreDir)) { Directory.CreateDirectory(bundleStoreDir); } if (extra.includeAssetPaths.Count == 0) { BundleManager.RefreshBundleDependencies(bundle); } // Start build string[] assetPaths = extra.includeAssetPaths.ToArray(); bool succeed = false; uint crc = 0; switch (bundle.bundleType) { case BundleType.Normal: succeed = BuildSceneBundle(assetPaths, outputPath, out crc); break; case BundleType.Scene: succeed = BuildSceneBundle(assetPaths, outputPath, out crc); break; case BundleType.Text: succeed = BuildSceneBundle(assetPaths, outputPath, out crc); break; default: throw new NotImplementedException(); } // Remember the assets for next time build test BundleBuildState buildState = BundleManager.GetBuildStateOfBundle(bundle.name); if (succeed) { foreach (var guid in extra.includeAssetGUIDs) { buildState.assetStates[guid] = BundleManager.GetAssetState(guid); } foreach (var guid in extra.dependGUIDs) { buildState.assetStates[guid] = BundleManager.GetAssetState(guid); } buildState.assetListMd5 = GetBundleAssetsListMD5(bundle); buildState.crc = crc; buildState.changed = true; buildState.requestString = bundle.name + "." + BuildConfiger.BundleSuffix; FileInfo bundleFileInfo = new FileInfo(outputPath); buildState.size = bundleFileInfo.Length; extra.needBuild = false; m_BuiltCount++; BMDataAccessor.ShouldSaveBundleStates = true; } return(succeed); }