Android bundles (play asset delivery)

Hello there !

See below, the forum are quite buggy right now

I’m not sure why, the forum keeps cutting my post.

So let’s try this again :

Several questions and remarks :

1. Google Play asset delivery
I’m trying to enable this : Unity - Manual: Play Asset Delivery

In editor we are told to enable App Bundle + Split Application Binary.

However in UCB “Split Application binary” directly refers to APK + OOB files, and there is a new option called Build Asset Packs. The comments for this option are not really in sync with the previously mentioned documentation.

What is the correct method to build those asset packs ?

2. Building assets packs via script

I can’t find the code to actually setup unity build to build the asset packs.

Is it :

EditorUserBuildSettings.buildAppBundle = true;

PlayerSettings.Android.useAPKExpansionFiles = true;

I usually prefer to setup unity manually in the PreExport phase, and that’s my next question

3. Clarification about build options and UCB control

How does UCB launches the build ?

I’m under the impression that some build options setup via script in the PreExport phase are overriden by UCB, but there is no documentation about this anywhere. I’m not sure what using batchmode implies, and I did not find any schema explaining UCB life cycle

It would make more sense to me to give the end user full control, if I want to override some build options in my PreExport method I should be able to do so.

I’m even more perplexed after reading the documentation of the Google plugin :

As I’m using 2020.3 I should not need this plugin then ? But then why does the UCB “Build asset packs” option has this documentation :

[quote]*
Enabling this option will use Google Play’s build method from the Google Play Unity Plugin to build an App Bundle with Asset Packs. The plugin must be installed in your project. You must also programmatically configure Asset Packs in a Pre-Build script and call AssetPackConfigSerializer.SaveConfig method. Enabling this will automatically enable the Build App Bundles option. See the official Android documentation for more details.
*[/quote]
*

Seems to me I need to use the “Build asset packs” option, but “Split binary” and “Build app bundle” together. How to be sure that this is working though ?

I’m going to try locally first, and I’ll update this thread. But I think UCB could benefit from some documentation about this

1 Like

It seems like you don’t have to turn on the “Build asset packs” toggle at all to get asset packs built.

In the end, I am able to get asset packs built successfully by

  • Enable “Split Application Binary”
  • Enable “Build App Bundles (.aab)”
  • Disable “Build asset packs”

My theory is that there are two ways to build asset packs

My guess is you only need to enable build asset packs if you want to build asset packs using the google play plugin. But if you plan on using the unity built-in way, you don’t have to enable the “Build asset packs” options at all.

(In my case, if I turn on both Build asset packs and Split Application Binary at the same time, it will even throw an error saying there’s a conflict in the settings)

Were you able to find any information?

I’m using 2020.3.2x and unity cloud build but I get “unable to initialize Unity error” when installed from play store.
I wonder that should I any pre export method or something on UCB / Untiy

UCB setting:
Ticked : Build asset pack & AAB
Unticked : split app binary

pre export:

var assetDeliveryConfig = AssetDeliveryConfigSerializer.LoadConfig();
assetDeliveryConfig.Refresh();
assetDeliveryConfig.SplitBaseModuleAssets = true;
AssetDeliveryConfigSerializer.SaveConfig(assetDeliveryConfig);

Google plugin:
Ticked: Separate base APK asset

Asset pack configuration:
No folder, default

Scene in build:
Selected 1 scene

Publishing setting:
Unticked custom gradles and split aplication binary

@crekri_1 @RDeluxe