# Google.Android.AppBundle.Editor.AssetBundleBuilder

Provides helper methods for building AssetBundles with various texture compression formats.

## Summary

| ### Public static functions ||
|---|---|
| `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetBundleBuilder#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetBundleBuilder_1a0e4491ec6e9f3412f7ce1720806e114e(string outputPath, AssetBundleBuild[] builds, https://developer.android.com/reference/unity/namespace/Google/Android/AppBundle/Editor#namespaceGoogle_1_1Android_1_1AppBundle_1_1Editor_1aa52c785c2a59c8d2e43ec24ccadad0dd deliveryMode, IEnumerable< MobileTextureSubtarget > additionalTextureFormats, BuildAssetBundleOptions assetBundleOptions, bool allowClearDirectory)` | `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig` Run one or more AssetBundle builds with the specified texture compression formats. |
| `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetBundleBuilder#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetBundleBuilder_1aec78e496a995bb6708e6ba79368b5722(string outputPath, AssetBundleBuild[] builds, BuildAssetBundleOptions assetBundleOptions, MobileTextureSubtarget baseTextureFormat, IEnumerable< MobileTextureSubtarget > additionalTextureFormats, bool allowClearDirectory)` | `Dictionary< string, Dictionary< https://developer.android.com/reference/unity/namespace/Google/Android/AppBundle/Editor#namespaceGoogle_1_1Android_1_1AppBundle_1_1Editor_1a156046a6839299c613cc5551270e867d, string > >` Run one or more AssetBundle builds with the specified texture compression formats. |
| `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetBundleBuilder#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetBundleBuilder_1a79f5a5159a48ca22dc554a41f8b45bf1(string outputPath, https://developer.android.com/reference/unity/namespace/Google/Android/AppBundle/Editor#namespaceGoogle_1_1Android_1_1AppBundle_1_1Editor_1aa52c785c2a59c8d2e43ec24ccadad0dd deliveryMode, Dictionary< string, AssetBundleBuild[]> deviceGroupToBuilds, string defaultDeviceGroup, BuildAssetBundleOptions assetBundleOptions, bool allowClearDirectory)` | `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig` Run one or more AssetBundle builds for the specified device groups. |
| `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetBundleBuilder#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetBundleBuilder_1a44da9f2c2efe9e19a507e7b19808f7ff(string outputPath, Dictionary< string, AssetBundleBuild[]> deviceGroupToBuilds, BuildAssetBundleOptions assetBundleOptions, bool allowClearDirectory)` | `Dictionary< string, Dictionary< string, string > >` Run one or more AssetBundle builds for each device group. |
| `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetBundleBuilder#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetBundleBuilder_1a75e8b5134489ba94d22325adc7483643(string outputPath, https://developer.android.com/reference/unity/namespace/Google/Android/AppBundle/Editor#namespaceGoogle_1_1Android_1_1AppBundle_1_1Editor_1aa52c785c2a59c8d2e43ec24ccadad0dd deliveryMode, Dictionary< https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/DeviceTier#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1DeviceTier, AssetBundleBuild[]> deviceTierToBuilds, https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/DeviceTier#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1DeviceTier defaultDeviceTier, BuildAssetBundleOptions assetBundleOptions, bool allowClearDirectory)` | `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig` Run one or more AssetBundle builds for the specified device tiers. |
| `https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetBundleBuilder#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetBundleBuilder_1ae1f5bda8e7e1cacb5742d0362a866b7a(string outputPath, Dictionary< https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/DeviceTier#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1DeviceTier, AssetBundleBuild[]> deviceTierToBuilds, BuildAssetBundleOptions assetBundleOptions, bool allowClearDirectory)` | `Dictionary< string, Dictionary< https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/DeviceTier#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1DeviceTier, string > >` Run one or more AssetBundle builds for each device tier. |

## Public static functions

### BuildAssetBundles

```c#
AssetPackConfig BuildAssetBundles(
  string outputPath,
  AssetBundleBuild[] builds,
  AssetPackDeliveryMode deliveryMode,
  IEnumerable< MobileTextureSubtarget > additionalTextureFormats,
  BuildAssetBundleOptions assetBundleOptions,
  bool allowClearDirectory
)
```
Run one or more AssetBundle builds with the specified texture compression formats.

Notes about the outputPath parameter:

- If a relative path is provided, the file paths in the returned [AssetPackConfig](https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig) will be relative paths.
- If an absolute path is provided, the file paths in the returned object will be absolute paths.
- AssetBundle builds for additional texture formats will be created in siblings of this directory. For example, for outputDirectory "a/b/c" and texture format ASTC, there will be a directory "a/b/c#tcf_astc".
- If allowClearDirectory is false, this directory and any sibling directories must be empty or not exist, otherwise an exception is thrown.

<br />

<br />

Details Parameters `outputPath` The output directory for the ETC1 AssetBundles. See other notes above. `builds` The main argument to BuildPipeline. `deliveryMode` A delivery mode to apply to every asset pack in the generated config. `additionalTextureFormats` Texture formats to build for in addition to ETC1. `assetBundleOptions` Options to pass to BuildPipeline. `allowClearDirectory` Allows this method to clear the contents of the output directory. **Returns** An [AssetPackConfig](https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig) containing file paths to all generated AssetBundles.

### BuildAssetBundles

```c#
Dictionary< string, Dictionary< TextureCompressionFormat, string > > BuildAssetBundles(
  string outputPath,
  AssetBundleBuild[] builds,
  BuildAssetBundleOptions assetBundleOptions,
  MobileTextureSubtarget baseTextureFormat,
  IEnumerable< MobileTextureSubtarget > additionalTextureFormats,
  bool allowClearDirectory
)
```
Run one or more AssetBundle builds with the specified texture compression formats.

This variant allows for overriding the base format and provides a different return type.

<br />

Details Parameters `outputPath` The output directory for base AssetBundles. See the other method for notes. `builds` The main argument to BuildPipeline. `assetBundleOptions` Options to pass to BuildPipeline. `baseTextureFormat` The default format. Note: ETC1 is supported by all devices. `additionalTextureFormats` Texture formats to generate for in addition to the base. `allowClearDirectory` Allows this method to clear the contents of the output directory. **Returns** A dictionary from AssetBundle name to TextureCompressionFormat to file outputPath.

### BuildAssetBundlesDeviceGroup

```c#
AssetPackConfig BuildAssetBundlesDeviceGroup(
  string outputPath,
  AssetPackDeliveryMode deliveryMode,
  Dictionary< string, AssetBundleBuild[]> deviceGroupToBuilds,
  string defaultDeviceGroup,
  BuildAssetBundleOptions assetBundleOptions,
  bool allowClearDirectory
)
```
Run one or more AssetBundle builds for the specified device groups.

Notes about the outputPath parameter:

- If a relative path is provided, the file paths in the returned [AssetPackConfig](https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig) will be relative paths.
- If an absolute path is provided, the file paths in the returned object will be absolute paths.
- AssetBundle builds for device groups will be created in siblings of this directory. For example, for outputDirectory "a/b/c" and device group X, there will be a directory "a/b/c#group_X".
- If allowClearDirectory is false, this directory and any sibling directories must be empty or not exist, otherwise an exception is thrown.

<br />

<br />

Details Parameters `outputPath` The output directory for AssetBundles. See other notes above. `deliveryMode` A delivery mode to apply to every asset pack in the generated config. `deviceGroupToBuilds` A dictionary from Device Group to asset bundle builds. All device groups should contain the same asset bundle names. `defaultDeviceGroup` Default device group to be used for standalone APKs. Set to null if not specified. `assetBundleOptions` Options to pass to BuildPipeline. `allowClearDirectory` Allows this method to clear the contents of the output directory. **Returns** An [AssetPackConfig](https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig) containing file paths to all generated AssetBundles.

### BuildAssetBundlesDeviceGroup

```c#
Dictionary< string, Dictionary< string, string > > BuildAssetBundlesDeviceGroup(
  string outputPath,
  Dictionary< string, AssetBundleBuild[]> deviceGroupToBuilds,
  BuildAssetBundleOptions assetBundleOptions,
  bool allowClearDirectory
)
```
Run one or more AssetBundle builds for each device group.

<br />

Details Parameters `outputPath` The output directory for base AssetBundles. See the other method for notes. `deviceGroupToBuilds` A dictionary from Device Group to asset bundle builds. All device groups should contains the same asset bundle names. `assetBundleOptions` Options to pass to BuildPipeline. `allowClearDirectory` Allows this method to clear the contents of the output directory. **Returns** A dictionary from AssetBundle name to device group to file outputPath.

### BuildAssetBundlesDeviceTier

```c#
AssetPackConfig BuildAssetBundlesDeviceTier(
  string outputPath,
  AssetPackDeliveryMode deliveryMode,
  Dictionary< DeviceTier, AssetBundleBuild[]> deviceTierToBuilds,
  DeviceTier defaultDeviceTier,
  BuildAssetBundleOptions assetBundleOptions,
  bool allowClearDirectory
)
```
Run one or more AssetBundle builds for the specified device tiers.

Notes about the outputPath parameter:

- If a relative path is provided, the file paths in the returned [AssetPackConfig](https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig) will be relative paths.
- If an absolute path is provided, the file paths in the returned object will be absolute paths.
- AssetBundle builds for device tiers will be created in siblings of this directory. For example, for outputDirectory "a/b/c" and device tier HIGH, there will be a directory "a/b/c#tier_high".
- If allowClearDirectory is false, this directory and any sibling directories must be empty or not exist, otherwise an exception is thrown.

<br />

<br />

Details Parameters `outputPath` The output directory for AssetBundles. See other notes above. `deliveryMode` A delivery mode to apply to every asset pack in the generated config. `deviceTierToBuilds` A dictionary from Device Tier to asset bundle builds. All device tiers should contains the same asset bundle names. `defaultDeviceTier` Default device tier to be used for standalone APKs. Set to zero if not specified. `assetBundleOptions` Options to pass to BuildPipeline. `allowClearDirectory` Allows this method to clear the contents of the output directory. **Returns** An [AssetPackConfig](https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/AssetPackConfig#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1AssetPackConfig) containing file paths to all generated AssetBundles.

### BuildAssetBundlesDeviceTier

```c#
Dictionary< string, Dictionary< DeviceTier, string > > BuildAssetBundlesDeviceTier(
  string outputPath,
  Dictionary< DeviceTier, AssetBundleBuild[]> deviceTierToBuilds,
  BuildAssetBundleOptions assetBundleOptions,
  bool allowClearDirectory
)
```
Run one or more AssetBundle builds for each device tier.

<br />

Details Parameters `outputPath` The output directory for base AssetBundles. See the other method for notes. `deviceTierToBuilds` A dictionary from Device Tier to asset bundle builds. All device tiers should contains the same asset bundle names. `assetBundleOptions` Options to pass to BuildPipeline. `allowClearDirectory` Allows this method to clear the contents of the output directory. **Returns** A dictionary from AssetBundle name to [DeviceTier](https://developer.android.com/reference/unity/class/Google/Android/AppBundle/Editor/DeviceTier#classGoogle_1_1Android_1_1AppBundle_1_1Editor_1_1DeviceTier) to file outputPath.