Publish content with Cloud Content Delivery
To publish content with Cloud Content Delivery (CCD), you have the following options:
- Use CCD Dashboard/CLI
- Use CCD Management package
Use CCD Dashboard/CLI
To generate and upload Addressable content to a CCD project:
- Set the profile you have set up for CCD as the active profile.
- Build the Addressables content.
- Upload the files created at the remote build path using the CCD dashboard or command-line interface.
- Create a release and update the badge using the CCD dashboard or command-line interface.
Building Addressable content generates a content catalog (.json
), a hash file (.hash
), and one or more AssetBundle (.bundle
) files. Upload these files to the bucket corresponding to the URL used in the profile load path.
If you have made changes to local content, you must create a new Player build.
Use CCD Management package
To generate, upload, and release Addressable content to your CCD project:
- Open the Groups window (menu: Window > Asset Management > Addressables > Groups).
- Use the Build & Release option.
The CCD Management package uses the default build script behavior to generate the Addressable bundles.
All groups associated with a path pair connected to a CCD bucket and badge via the drop-down window have their generated AssetBundles uploaded by the management package to the remote target.
Finally, the management package creates a release for the remote target and updates their badge.
CcdManager
When setting up the project profile path pairs you can use the Automatic
option. This option uses the CcdManager
to set static properties at runtime to tell Addressables which Environment, Bucket, and Badge to use for loading assets. The CcdManager
has the following properties: EnvironmentName
, BucketId
, and Badge
. Setting these properties at runtime before Addressables initializes tells Addressables to look at these locations within CCD. To learn more about environments, buckets, and badges refer to CCD organization.
Example snippet of setting CcdManager properties:
CcdManager.EnvironmentName = ENV_NAME;
CcdManager.BucketId = BUCKET_ID;
CcdManager.Badge = BADGE;
// Addressables call to load or instantiate asset
Note
Any Addressables call initializes the system so be sure to set the CcdManager
before any Addressables call to ensure that there are no race conditions or unexpected behaviors.
Use build events
CCD provides a means of wrapping the build and upload service to provide additional functionality.
You can add additional events to PreUpdate and PreBuild event chains.
#if (UNITY_EDITOR && ENABLE_CCD)
using System.Threading.Tasks;
using UnityEditor.AddressableAssets.Build;
public class BuildHooks
{
static void AddBuildHook()
{
CcdBuildEvents.PrependPreBuildEvent(PrintBucketInformation);
CcdBuildEvents.PrependPreUpdateEvent(PrintBucketInformation);
}
static async Task<bool> PrintBucketInformation(AddressablesDataBuilderInput input)
{
UnityEngine.Debug.Log($"Environment: {CcdManager.EnvironmentName}");
UnityEngine.Debug.Log($"Bucket: {CcdManager.BucketId}");
UnityEngine.Debug.Log($"Badge: {CcdManager.Badge}");
return true;
}
}
#endif
Disable version override warnings
If you get warnings about overriding the player version and want to keep your current setup, you can disable the warnings by removing the corresponding build events.
#if (UNITY_EDITOR && ENABLE_CCD)
using UnityEditor;
using UnityEditor.AddressableAssets.Build;
public class DisableBuildWarning
{
static void DisableWarning()
{
CcdBuildEvents.OnPreBuildEvents -= CcdBuildEvents.Instance.VerifyBuildVersion;
CcdBuildEvents.OnPreUpdateEvents -= CcdBuildEvents.Instance.VerifyBuildVersion;
}
}
#endif