Google is committed to advancing racial equity for Black communities. See how.

Build for Unity

Use this guide to build Play Asset Delivery into your Unity project.

Overview

Unity AssetBundle files contain serialized assets that can be loaded by the Unity engine while the app is running. These files are platform-specific (for example, built for Android) and can be used in combination with asset packs. Most commonly, one AssetBundle file is packaged into a single asset pack, with the pack using the same name as the AssetBundle.

At runtime, use the Play Asset Delivery for Unity class to retrieve an AssetBundle packaged in an asset pack.

Prerequisites

  1. Get the Unity plugin (or package) for Play Asset Delivery.

  2. Create AssetBundles in Unity.

Configure AssetBundles using the UI

  1. Configure each AssetBundle in an asset pack:

    1. Select Google > Android App Bundle > Asset Delivery Settings.
    2. To select folders that directly contain AssetBundle files, click Add Folder.

  2. For each bundle, change the Delivery Mode to Install Time, Fast Follow, or On Demand. Resolve any errors or dependencies and close the window.

  3. Select Google > Build Android App Bundle to build the app bundle.

Configure AssetBundles using the API

You can configure asset delivery through editor scripts which can be run as part of an automated build system.

Use the AssetPackConfig class to define which assets to include in an Android App Bundle build, as well as the delivery mode of the assets.

Use the static BuildBundle method in the Bundletool class to generate an Android App Bundle with asset packs, given BuildPlayerOptions and AssetPackConfig.

Next step

Integrate Play Asset Delivery into your game or app code using Unity.