Building Bundles
The building process for asset bundles is managed by the BundleBuilder utility.
It uses BundleConfig scriptable objects to define what assets are bundled.
BundleBuilder supports building bundles for multiple platforms in a single pass.
Process Overview
-
Create one or more
BundleConfigscriptable objects. -
Set asset references to the
BundleConfig -
Select the target platforms (e.g., Android, iOS, WebGL, Windows).
-
Call
BundleBuilder.BuildBundles()with the configs and platforms. -
Bundles are saved to the specified output path, organized by platform.
After building, a custom manifest JSON file is generated alongside each bundle, describing its contents and dependencies.
Code Example
var bundleConfigs = LoadAllBundleConfigs();
var platforms = new List<BundlePlatform> { BundlePlatform.Android, BundlePlatform.iOS };
BundleBuilder.BuildBundles(bundleConfigs, platforms, "Builds/Bundles");
Output Structure
The build process produces:
-
A directory per platform (e.g.
Assets/Bundles/Android/) -
Inside each platform directory:
-
The asset bundle files (e.g.
bundleName) -
Corresponding
.jsonmanifest files (e.g.bundleName.json) -
The Unity-generated
AssetBundleManifestfile (e.g.bundleName.manifest)
-
Each asset bundle is built with correct dependency information. A custom JSON manifest is saved alongside each bundle for runtime use.