Using Addressables in Unity Build Automation

Addressable Assets are assets that have a unique address which you can use to load them from local or remote AssetBundles.

Prerequisites

Before you can build Addressable Assets in Build Automation, you must:

  • Convert your project to use Addressables locally by:
  • Commit your updated project to your chosen version control system (VCS).

Configuring the Build Target

If you’re starting from a new Build Automation project, you’ll need to create a new Build Target first.

  1. Sign in to the Unity Cloud Dashboard.
  2. Select DevOps > Build automation > Configurations.
  3. Select the build target that you’d like to build Addressables for.
  4. Select Edit.
  5. From the Advanced settings tab, select Yes, build Addressables.

Use the Addressables section to configure properties that determine how the Addressables build process behaves. Each property is described in more detail with a tooltip.

Running a new Addressables build

To run a new Addressables build:

  1. Complete the steps in Configuring the build target.
  2. Select Save and build.

Enable Cloud Content Delivery service

To upload Addressables to the Cloud Content Delivery (CCD) service from Build Automation:

  1. From your build targets advanced settings, navigate to the Addressables section.
  2. Select Upload Addressables to the Cloud Content Delivery service.
  3. Select the required CCD bucket in the Content Delivery Bucket drop-down.
  4. Your Content Delivery API Key should already be populated in its field. If not, add it.
  5. To automatically create a CCD release from the selected bucket, select Automatically create a Cloud Content Delivery release from the bucket.
  6. Select Save and build.

For more information about using Addressables with CCD, see CCD + Addressables walkthrough.

Running a content-update build

Content update builds update a previously built player with new addressable content.

To update the existing player, update builds require a Content State file. This links the content from an Update build to an existing player. The Content State file is generated when you do a new Addressables build.

To update a previously built player with new Addressable assets:

  1. Click Edit Addressables Asset Options.
  2. Select Yes, build Addressables and Make a content-update build.
  3. Select Make a content-only build (unless you want to produce another Player).
  4. Set the content state file location method to define how Build Automation gets the Content State file.
    Build Automation can get this file in the following ways.
    • From source control; in which case you must specify the path.
    • From an existing build target which has previously successfully built Addressables; in which case you must specify the target.

Build Automation can automatically use the most recent Content State file produced by the selected Build Target.

Starting a build

When the build target is configured, to start a new Addressables build:

  1. Navigate to Build Automation, Build History.
  2. Build the target you’ve configured Addressables for.

When the new build has successfully completed, the More menu (⋮) for the build displays the Download Addressable Assets option.

Copying Addressables content from Build Automation to your hosting provider

Once you've completed an Addressables build, you can copy the Addressables content from Build Automation to your hosting provider. You can do this manually, or use a post-build script.

Copying Addressables content manually

Once you’ve completed an Addressables build, select Download Addressables Assets from the More menu (⋮). When you’ve downloaded the content, you can upload it to your hosting provider as you normally would when building locally.

Copying Addressables content with a post-build script

Build Automation supports running a custom shell script before or after a build. You can create a post-build script to automatically upload your Addressables content when a build successfully completes.

To enable a post-build script:

  1. Navigate to the Build Automation Config page.
  2. On your Build Target, select Edit Advanced Options.
  3. In the Post-Build Script Path field, enter the path to your script.

The following tips might be useful to consider when writing your script:

  • The Addressable content for your build is located at $WORKSPACE/.build/last/<BUILD_TARGET_ID>/extra_data/addrs/

  • You can set environment variables for secret keys in the Build Target Config page.