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 SettingsA broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your project behave. More info
See in Glossary, 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 BuildThe process of compiling your project into a format that is ready to run on a specific platform or platforms. More info
See in Glossary and want to install the app manually using the ADBAn Android Debug Bridge (ADB). You can use an ADB to deploy an Android package (APK) manually after building. More info
See in Glossary 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 SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary 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:
APKThe Android Package format output by Unity. An APK is automatically deployed to your device when you select File > Build & Run. More info
See in Glossary - Consists of the executables (Java and native), plug-insA set of code created outside of Unity that creates functionality in Unity. There are two kinds of plug-ins you can use in Unity: Managed plug-ins (managed .NET assemblies created with tools like Visual Studio) and Native plug-ins (platform-specific native code libraries). More info
See in Glossary, scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary, 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
Updated functionality in 5.5