private static void CreateBundleAsync( AppBundleBuilder appBundleBuilder, string aabFilePath, AssetPackConfig assetPackConfig, bool runOnDevice) { var callback = runOnDevice ? (AppBundleBuilder.PostBuildCallback)RunBundle : EditorUtility.RevealInFinder; var createBundleOptions = new CreateBundleOptions { AabFilePath = aabFilePath, AssetPackConfig = assetPackConfig }; appBundleBuilder.CreateBundleAsync(createBundleOptions, callback); }
private static bool Build(AppBundleBuilder appBundleBuilder, AppBundleBuildSettings buildSettings) { var androidBuildResult = appBundleBuilder.BuildAndroidPlayer(buildSettings.buildPlayerOptions); if (!androidBuildResult.Succeeded) { return(false); } var aabFilePath = buildSettings.buildPlayerOptions.locationPathName; if (IsBatchMode || buildSettings.forceSynchronousBuild) { var createBundleOptions = new CreateBundleOptions { AabFilePath = aabFilePath, AssetPackConfig = buildSettings.assetPackConfig }; var errorMessage = appBundleBuilder.CreateBundle(createBundleOptions); return(errorMessage == null); } #if UNITY_2018_3_OR_NEWER CreateBundleAsync(appBundleBuilder, aabFilePath, buildSettings.assetPackConfig, buildSettings.runOnDevice); #else var task = new AppBundlePostBuildTask { serializableAssetPackConfig = SerializationHelper.Serialize(buildSettings.assetPackConfig), workingDirectoryPath = appBundleBuilder.WorkingDirectoryPath, aabFilePath = aabFilePath, runOnDevice = buildSettings.runOnDevice }; PostBuildRunner.RunTask(task); #endif // This return value should be ignored since the build is being finished asynchronously. return(true); }