APK expansion files are used as a solution for the 100MB app size limit in the Google Play Store. If your app is larger than 100MB (which is quite likely for a big game), you have to split your output package into the main part (APK) and the expansion file (OBB). Refer to the Android Developer documentation on expansion files for more information.
Unity automatically splits the output package into APK and OBB. This is not the only way to split the app package (other options include third-party plug-ins and AssetBundles), but it is the only automatic splitting mechanism officially supported by Unity.
Note: Unity only creates the main expansion file. If you want to manually create the patch expansion file, you must include a file named with your build-id; otherwise, the patch expansion file won’t load. The file can be empty, but you must place it in the
Assets directory inside the patch expansion file. This file’s name must match the
unity.build-id metadata, which Unity automatically adds to the manifest when you build the APK. Alternatively, you can copy this file from the main expansion file into the patch expansion file.
If you want Unity to split the app output package into APK and OBB for you, open the Player settings (menu: Edit > Project Settings, then select the Player category), and in the Publishing Settings panel, enable the Split Application Binary property.
Both parts of the output package (APK and OBB) are copied to the output directory you specify when building the app. For example, if the APK has the name mygame.apk, the OBB is in the same directory under the name mygame.main.obb.
If you select Build and Run, the APK and OBB files are installed on your device by Unity. If you select Build and want to install the app manually using the ADB utility, you must first install the APK and then copy the OBB into the correct location on your device. The OBB file name must correspond the format required by Google. Refer to the expansion files section of the Android Developer documentation for more information.
If the app starts and can’t find and load the OBB, only the first Scene is available (see documentation on how data is split between the APK and OBB below for more information). Do not use the contents of the OBB separately - always treat the APK and OBB as a unique bundle, the same way as you would treat a single APK.
When the Split Application Binary option is enabled, the app is split the following way:
APK - Consists of the executables (Java and native), plug-ins, scripts, and the data for the first Scene (with the index 0).
OBB - Contains everything else, including all of the remaining Scenes, resources, and streaming Assets.
If your APK is still too large for publishing in the Google Play Store (more than 100MB), try reducing the size of your first Scene, making it as small as possible.
The Unity Asset Store offers a plug-in that allows you to access an adapted version of the Google Play
market_downloader library for Unity, which you can use to download the OBB from Google Play Store, or an external source, and move it into the correct directory.
OBB expansion files should be published to the Google Play Store along with your APK. Any OBB files published with your APK will be automatically downloaded when a user installs your app from the Google Play Store.
You should include code in your app that downloads missing OBB files in the case of a Google Play Store error, or if a user removes the OBB files from their device. For more information about downloading OBB files, refer to the APK Expansion file section of the Android Developer documentation.
You can also host OBB files yourself if you do not want to use the Google Play Store. However, hosting OBB files without using the Google Play Store is only recommended for advanced users.
2017–05–25 Page published
Funcionalidad actualizada en 5.5