This package provides a utility to pack StreamingAssets into an OBB (Opaque Binary Blob) expansion file and mount it directly to the Android filesystem.
On Android, Unity typically handles large builds by splitting them into an APK and an OBB expansion file. However, this creates a significant technical hurdle for developers using native libraries:
By default, Unity treats the OBB like a standard zip archive. While Unity's internal UnityWebRequest or Resources APIs can "see" inside it via the jar:file:// protocol, the Android OS does not actually mount the file into the filesystem. It remains a single compressed blob that the OS views as a single file.
Most native AI engines and C++ plugins (ONNX Runtime, Llama.cpp, TensorFlow Lite) require a standard absolute file path (e.g., /storage/emulated/0/...).
- Native Failure: They cannot "reach inside" a compressed OBB or APK.
- No Abstraction: They do not have access to Unity's internal asset management layer.
- Result: Even if your model is inside the OBB, passing a path to a native plugin will return a
File Not Founderror because the path isn't "real" to the Linux kernel.
To bypass this, developers usually copy models from the OBB to Application.persistentDataPath at runtime. This results in:
- Wasted Space: A 2GB model now takes up 4GB of user storage (one copy in the OBB, one in the data folder).
- Slow First Launch: Users must wait minutes for the "extraction" process to finish before the AI is ready.
This tool mounts the OBB as a virtual filesystem, providing a direct, raw path to your assets that native C++ libraries can read immediately with zero copying and zero storage overhead.
| Feature | Standard Unity OBB | OBB Mounter (This Tool) |
|---|---|---|
| Access Method | Unity-only APIs (WebRequest) | Standard File I/O (File.Open) |
| Native Compatibility | ❌ No | ✅ Yes (Direct Path) |
| Disk Overhead | 2x (if extracted for native) | ✅ 1x (Zero Copy) |
| Initial Load Time | Slow (Extraction required) | ✅ Instant |
- OBB is Obsolete: Google Play now uses Play Asset Delivery (PAD) for production.
- Intended Use: This is a debugging/testing utility to help AI developers iterate quickly without writing complex extraction logic.
- Compatibility: OBB mounting relies on the Android
StorageManagerAPI, which can vary across device manufacturers and Android versions.
- Setup: Drag and drop the
AndroidObbMountprefab into your initial scene. - Persistence: Keep the prefab alive (or use
DontDestroyOnLoad) if you are changing scenes, or the OBB file will be unmounted. - Implementation: Use a coroutine to wait for the mount point to resolve. If mounting fails, the tool falls back to the standard
Application.streamingAssetsPath.
using System.Collections;
using UnityEngine;
using System.IO;
public class MyModelLoader : MonoBehaviour
{
IEnumerator Start()
{
// Wait until the mount point is resolved by the prefab
while (string.IsNullOrEmpty(AndroidObbMount.AndroidObbMount.mountPoint))
{
yield return null;
}
string rootPath = AndroidObbMount.mountPoint;
string modelPath = Path.Combine(rootPath, "my_ai_model.onnx");
Debug.Log("Accessing model at: " + modelPath);
// Pass modelPath directly to your native AI plugin (C++/Rust/etc)
MyNativePlugin.Init(modelPath);
}
}