Play Asset Delivery (PAD) is a Google Play Store feature you can use to deliver applications that are larger than 150MB. Instead of using APK expansion files (OBB) to store additional assets (such as textures, sounds, and meshes), PAD uses asset packs. Google hosts and serves asset packs on Google Play, which means you don’t need to create a content delivery network to send application resources to users. For more information about PAD, see Android’s Play Asset Delivery.
Important: PAD is only available for the Google Play Store. If you have a large application and want to support other digital distribution services, use APK expansion files (OBB).
To use Play Asset Delivery, you need to set up your project to build Android App Bundles and split the application binary.
To configure Unity to build Android App Bundles:
To configure Unity to split the application binary:
Now when you build your application, Unity generates an Android App Bundle that includes your application split into a base module and asset packs.
Alongside the asset packs that Unity generates automatically, you can also create your own custom asset packs. This is useful when you need to control what an asset pack contains. Unity adds your custom asset packs to the final Android App Bundle. For more information about custom asset packs and how to set them up, see Custom asset packs.
Asset packs have download size limits. To account for this, Unity changes how it generates asset packs depending on the size of your additional assets:
install-time
delivery mode. If you do not create any custom asset packs, this means that the device downloads the asset pack as part of the application installation and, when the user first launches the application, all assets are available.install-time
delivery mode to the larger asset pack and assigns the fast-follow
delivery mode to the smaller one.Note: If either of these asset packs is larger than the upload limit the Google Play Store allows, Unity displays a warning but doesn’t fail the build. Also, Unity checks the sizes of asset packs individually and doesn’t perform size verification for custom asset packs. This means that, if a combination of custom asset packs and asset packs that Unity generates is too large for the Google Play Store, Unity doesn’t display a warning or error.
For asset packs that Unity automatically generates, Unity does not support changing the delivery mode. If you want to change the delivery mode of an asset pack, create custom asset packs with your assets.
Unity provides APIs to manage asset packs at runtime. They use Google’s PlayCore API, which means they have the same limitations as PlayCore, and can’t manage install-time
asset packs. Using the PlayCore API also means your application requires the PlayCore plugin. If your project has asset packs, either custom asset packs or Unity-generated asset packs, Unity automatically adds the PlayCore dependencyIn the context of the Package Manager, a dependency is a specific package version (expressed in the form package_name@package_version
) that a project or another package requires in order to work. Projects and packages use the dependencies attribute in their manifests to define the set of packages they require. For projects, these are considered direct dependencies; for packages, these are indirect, or transitive, dependencies. More info
See in Glossary to the application’s manifest.
The way you download asset packs and access their assets depends on the asset pack delivery mode. There are three asset pack delivery modes:
install-time
: Google Play automatically downloads install-time
asset packs when the device installs the application. Google Play considers these asset packs to be part of the base application, and an end user can’t uninstall them without uninstalling the entire application. The PlayCore API doesn’t handle install-time
asset packs, which means that you can’t check the status, request to download, or remove install-time
asset packs. You also can’t directly access assets inside of these asset packs, except streaming assets in Unity-generated install-time
asset packs. To access streaming assets, use Application-streamingAssetsPath to get the path to streaming assets location, then use UnityWebRequest to access assets in that path. If you create a custom asset pack, you can’t access assets inside it using standard file APIs. Instead, use Android’s AssetManager APIs.fast-follow
: Google Play automatically starts to download fast-follow
asset packs after it installs the application. However, it is possible that not all fast-follow
asset packs are available on the first time the application launches. To check the status and download fast-follow
asset packs, see below.on-demand
: Google Play doesn’t automatically download on-demand
asset packs. You have to manually start the download. For information on how to do this, see below.For more information about delivery modes, see Delivery modes.
If your application uses fast-follow
or on-demand
asset packs, the device must download these asset packs before the application can access assets inside of them. To check the status of asset packs and download them if they are not on the device, you must first know the name of each asset pack. To get the names of Unity-generated asset packs, call AndroidAssetPacks.GetCoreUnityAssetPackNames. There is no runtime API to get the names of custom asset packs so you must keep track of them yourself. You set the name of custom asset packs at build time; it’s the name of the directory.
After you have the names of your asset packs, to check the status of each asset pack, call AndroidAssetPacks.GetAssetPackStateAsync, passing in the asset pack name. This returns the status of the asset pack you query, and you can use the result to determine whether you need to download the asset pack. If you want to quickly query the status of every Unity-generated asset pack, you can use AndroidAssetPacks.coreUnityAssetPacksDownloaded. This is useful because you must ensure that every Unity-generated asset pack is available before you load any scene other than the first one or try to access other resources that Unity handles.
For every asset pack you need to download, call AndroidAssetPacks.DownloadAssetPackAsync, passing in the asset pack name. While the asset pack downloads, monitor the download status, because downloads can pause or fail. There are two ways to do this:
If you want to control which non-code resources are in a particular asset pack, you can create a custom asset pack. Unlike Unity-generated asset packs, you can set the delivery mode for custom asset packs. If you create a custom asset pack, be aware that the Google Play Store has size and quantity limits for asset packs. For information on the limits, see Download size limits.
To create a custom asset pack, create a directory with a name that ends with .androidpack. You can place this directory anywhere in your project’s Assets directory, or any subdirectory. For example, to create a custom asset pack named MyAssets1:
on-demand
, which means that if you don’t change the delivery mode, you need to manually download the asset pack at runtime. For information on how to do this, see Managing asset packs at runtime.apply plugin: 'com.android.asset-pack'
assetPack {
packName = "MyAssets1"
dynamicDelivery {
deliveryType = "fast-follow"
}
}
This sets the delivery mode to fast-follow
, which means Google Play automatically downloads the asset pack after it installs the application. For information on the format of this file, see Integrate asset delivery.
Note: The packName you specify in the build.gradle
file should match the asset pack directory name you set without the .androidpack extension.