Build Addressable Profile During a Unity Cloud Build

I am not really sure where to start in regards to getting addressables and Unity Cloud Build to work together.

Current State

  • I can make and run local iOS builds with Addressables using a manual click of the Build Player Content menu option before doing the iOS build
  • I can have a Unity Cloud Build setup that can make iOS builds that do not include the addressable assets (because I do not commit the cooked StreamingAssets to my repo I assume).

Goal

  • Have Unity Cloud Build build the addressable content for a “Production” profile before doing the build.

Constraint

  • I would like to not have to commit any local build artifacts to my Repo (ie. Generation fo the StreamingAssets folder)

Checkout this script, and the comment in the header.

This worked great and resolved my issue. Thank you!

Hi, I am using the same code to build the assets but I get following error. This only happens during cloud build, local build is fine. Some ideas?

Hi @Konstantin_Playtino , a good percentage of cloud build issue are missing files. I guess you may forget to commit a file or that file is ignored by git (via .gitignore).

From the log, the CloudBuildHelper.PreExport method is executed and failed at AddressableAssetEntry.CreateCatalogEntries()

        public void CreateCatalogEntries(List<ContentCatalogDataEntry> entries, bool isBundled, string providerType, IEnumerable<object> deps, object extraData)
        {
            var assetPath = GetAssetLoadPath(isBundled);
            var keyList = CreateKeyList();
            var mainType = AssetDatabase.GetMainAssetTypeAtPath(AssetPath);
          
            if (mainType == typeof(SceneAsset))
                mainType = typeof(SceneInstance);

            if (!CheckForEditorAssembly(ref mainType, assetPath))
                return;

The mainType seems null, caused by a non-existing AssetPath.

Hi @Favo-Yang , I actually know this type of error and I also checked my files. Like I said the local build runs without the issue. I downgraded Addressables to 1.1.4 and now cloud build works again. I don’t know why but thanks for your response.

Hi @Konstantin_Playtino , would you mind submit a ticket [Cloud build > Support > OPEN A TICKET]. It sounds a bug.