I know this question is old, but I just ran into it myself and I haven't found a good answer out there yet, especially if you're using Unity's Cloud Build service. You used to be able to split your binary into two files, an APK with the code and your first scene and an OBB file with everything else, but as of August 2021, this approach is no longer supported by Google Play.
The first thing you need to do is download the Unity plugins provided by Google here: https://github.com/google/play-unity-plugins/releases. I just downloaded the whole zip file, unzipped it, and put everything in a new folder I created in my project (Assets/GooglePlayPlugins).
Next, make sure that “Split Application Binary” is unchecked in your player settings (Player Settings -> Android -> Publishing Settings); that’s the checkbox for the old OBB approach. The next steps are a little different, depending on if you’re doing a local build or using Cloud Build.
Local Build
If you have the plugins from Google installed in your project, then you should have a new menu available called “Google”. In there go “Google -> Android App Bundle -> Asset Delivery Settings” and check the box that says “Separate Base APK Assets”. Then, instead of using the regular build dialog from Unity, build your project using “Google -> Build Android App Bundle”.
Cloud Build
Assuming you don’t check the Library folder into source control (aka, assuming you’re not crazy), then you need to have some code in a Pre-Build script that sets “Separate Base APK Assets” the setting for you (At least currently….Cloud Build hasn’t exposed it as an option in their UI yet). I do mine in a Pre-Export Method so I can use a C# script instead of a shell script. Here’s my code:
using Google.Android.AppBundle.Editor.Internal.AssetPacks;
public class CloudBuild
{
#if UNITY_CLOUD_BUILD
public static void PreExport(UnityEngine.CloudBuild.BuildManifestObject manifest)
{
var assetDeliveryConfig = AssetDeliveryConfigSerializer.LoadConfig();
assetDeliveryConfig.Refresh();
assetDeliveryConfig.SplitBaseModuleAssets = true;
AssetDeliveryConfigSerializer.SaveConfig(assetDeliveryConfig);
}
#endif
}
In addition to that code, you’ll also need to set a couple of options in the Cloud Build UI. Go to your Build Config and then to Advanced Options. Check the boxes that say “Build App Bundles (.aab)” and “Build Asset Packs”. Also make sure the box that says Split Application Binary is NOT checked.
Either Way
With a local build or with Cloud Build, you’ll know you did it right by taking the resulting AAB file and unzipping it. In the extracted folder you should see two subfolders, “base” and “base_assets”. If you only see “base” then something went wrong. Another indicator of correctness is that the size of the compressed AAB file should be comparable to your old APK or APK+OBB size.