Version: 2020.2
Including specific Scenes
Manifest de la construcción

Using Addressables in Unity Cloud Build

Addressable Assets are assets that have a unique address which you can call from anywhere.

Pre-requisitos

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

  • Convert your project to use Addressables locally, that is:
  • Install the Addressables package
  • Set the Assets as Addressable
  • Commit your updated project to your chosen version control system (VCS)

Unity recommends that you’re comfortable working with Addressables locally before you build them with Cloud Build.

Configuring the Build Target

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

  1. From the Cloud Build Dashboard, navigate to the build target Config page for your project.
  2. On the build target that you’d like to build Addressables for, expand the Addressable Assets Options menu.
  3. Click on Edit Addressable Asset Options.

Use the Addressables Options page 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. Click Edit Addressables Asset Options.
  2. Enable Build Addressables.
  3. Save the Target configuration.
  4. Build the Target.

Enable Cloud Content Delivery service

If you want to upload Addressables to the Cloud Content Delivery (CCD) service from Cloud Build:

  1. Click Edit Addressables Asset Options.
  2. Enable Content Delivery Upload to upload Addressables to CCD.
  3. Choose 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. Enable Content Delivery Create Release if you want to automatically create a CCD release from the selected bucket.
  6. Save the Target configuration.
  7. Build the Target.

See Addressable Asset system with Cloud Content Delivery for more information about using Addressables with CCD.

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. Enable Build Addressables and Content Update Build.
  3. Enable Content Only Build (unless you want to produce another Player).
  4. Set the Content State Location Method to define how Cloud Build gets the Content State file.
    Cloud Build 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.

Cloud Build 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 the Build History page of the dashboard.
  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 Cloud Build to your hosting provider

Once you’ve completed an Addressables build, you can copy the Addressables content from Cloud Build to your hosting provider. You can do this manually, or by using 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

Cloud Build 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. Go to the Cloud Build 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

  • [FeatureName] added in 2018.3 NewIn20183
Including specific Scenes
Manifest de la construcción