Over-the-air content delivery
When you add new content to your game, releasing a new version of your application means users must then install the update before they can play it. Alternatively, if you use an over-the-air content approach, players can open the application and begin interacting with the game while new content downloads in the background or during idle times.
This sample uses a menu screen to download and install new content without leaving the game.
To use this sample use case, you must download and install the UGS Use Cases project in your Unity project.
This sample demonstrates how to download new content from the cloud while the game is running. The client pings the Remote Config service, which informs the client that there is new content and where to get it.
Note: This sample primarily uses Addressables with Cloud Content Delivery to add new content to the game while it's running. The Remote Config, Economy, and Cloud Code service functions used are not strictly required for the content delivery part to work.
When the scene loads, the
OverTheAirContentSceneManager.cs script performs the following initialization tasks:
- Initializes Unity Gaming Services.
- Signs in the player anonymously using the Authentication service. If you’ve previously initialized any of the other sample scenes, Authentication will use your cached Player ID instead of creating a new one.
- Downloads all configuration data from Remote Config, some of which is necessary to detect and download new content.
When the scene loads, there is a Begin button. When you press it, an interstitial screen appears, and the new content automatically begins downloading. When the download completes, you can click the Play button to continue to view and interact with the new content.
You can click one of the two Restart Sample buttons to return to the beginning. If you choose to clear the cache, the sample will download the content again from Cloud Content Delivery.
To replicate this use case, you need the following Unity packages in your project:
|Addressables||Allows developers to retrieve an asset by using its address. In this sample, the service looks up event-specific images and prefabs based on the information received from Remote Config.|
|Authentication||Automatically signs in the user anonymously to keep track of their data server-side.|
|Cloud Content Delivery (CCD)||Hosts the content asset bundle of the new content.|
|Remote Config||Provides key-value pairs where the value that is mapped to a given key can change on the server side, either manually or based on specific Game Overrides. In this sample, it informs the client of new content updates.|
Note: Though it is listed as a package and requires separate dashboard configuration, the Cloud Content Delivery package doesn't need to be installed in your project. It hosts the content asset bundle, but Addressables is used to download the content in the project.
To use these services in your game, activate each service for your Organization and project in the Unity Dashboard.
To replicate this sample scene's setup on your own dashboard, you need to:
- Upload an Addressables build (catalog and asset bundle) to a Cloud Content Delivery bucket.
- Configure values for the Remote Config service.
Cloud Content Delivery
You can use Addressables to build asset bundles (and optionally content catalogs), which you can then upload to CCD for download in your game. This process isn't detailed in this document, but you can learn about it in the CCD and Addressables tutorial.
It's very common to use Addressables and CCD from a single project. However, this example demonstrates a multi-project setup. Developers with bigger teams might use the latter approach for a number of reasons:
- Reduce iteration time by making the main project smaller.
- Segment different types of work across multiple teams using smaller projects.
- Enable user-generated content.
This example uses a multi-project setup. One Unity project acts as the main project that downloads new content at runtime, while a separate Unity project builds new content into asset bundles for the main project to download. The main project only knows about new content built by the second project because of the Remote Config service.
Note: To see how this sample's second project is configured, look at the
ota-content branch of the Use Cases repository.
To make the multiple-project setup work, you'll need to upload a remote catalog along with your asset bundles.
In your content build project:
- In the Unity Editor, select the
AddressableAssetSettingsasset to view it in the Inspector.
- Enable the Build Remote Catalog option.
- Perform your Addressables build.
- In the resulting build folder, there will be a catalog JSON file and a catalog hash file. Upload both files to your CCD bucket along with the related asset bundles.
To learn more about using Addressables with multiple projects, see the documentation on loading from multiple projects.
After you've uploaded an Addressables build to a CCD bucket, make notes of a few things that you'll use in the Remote Config settings:
- The Addressable Remote Path URL for the bucket (found in the bucket page of the dashboard).
- The name of the content catalog JSON file.
- The addresses of any assets you want to download.
Set up the following config values in the LiveOps dashboard:
|string||The URL for the Addressables catalog file in the CCD bucket.||The bucket URL provided to you by the CCD dashboard, concatenated with the catalog JSON file name at the end. See the example below.|
|JSON||Indicates that there is new content to download. Each entry represents a new value in Remote Config.|
|JSON||Information about the new content. In this case it's simple, but you could have lots of information here.|