Hi, I’ve been banging my head on this for about 3 days now and still haven’t made much progress. Documentation and resources on this are pretty confusing/conflicting, at least from what I’ve been able to find. Maybe someone here has done something similar and can guide me on the best path. Please let me know if there is a better place to post this question.
I’m developing for Oculus Quest 2 with Unity 2021.
I have multiple large video files that total around 7GB.
OBB files have a maximum size allowed of 4GB for Oculus Quest 2.
I have successfully used “Split Application Binary” to generate a very small APK and an OBB (main.1.com.myapp.demo) that is placed in “Internal shared storage/Android/obb/com.myapp.demo”. The main OBB contains the first half of my video files. I am able to run my app and access those Videos.
This is where things break down for me. I manually created an AssetBundle. The process creates these files: AssetBundles, AssetBundles.manifest, videos, videos.manifest. The “videos” files is large and I’m assuming contains all the Videos I specified for this AssetBundle.
I renamed the “videos” file to “patch.1.com.myapp.demo” and placed in the same directory as the main OBB in the previous step.
I try to load the file from Start() in a script in the main scene with
I see these errors in logcat when I launch my app:
04-10 12:40:06.462 13313 13342 E Unity : Unable to open archive file: /Android/obb/com.myapp.demo/patch.1.com.myapp.demo.obb
04-10 12:40:06.462 13313 13342 E Unity : Failed to read data for the AssetBundle 'patch.1.com.myapp.demo.obb'.```
I'm not sure where I'm going wrong in the process. Is there a different approach I should be taking in general instead of patch OBB files? It seems like patch OBB files is the industry standard as a lot of large games on the Oculus store or apps that have downloadable content use patch OBBs. I don't want to stream the videos from a server or download the assets while the app is already running. The goal would be to have these patch OBBs marked as necessary when submitted to Oculus store so they are downloaded with the main apk.
If I can get this working, I'll make a nice guide so others doing something similar can get this working in the future.
Unity puts a GUID file inside apks and obbs, to ensure all files are from the same build. If you are making obbs yourself, you need to manually put a guid file. Obbs that we produce and support are zip files, just make sure to use archiver that doesn’t change the layout of the archive (for example the Mac built-in archiver is known to put everything inside a directory and then nothing works).
Thanks Aurimas. That’s actually really helpful and I have seen some vague references to the method you’re doing, but I’m still unclear on some steps.
When making obbs manually, I assume you aren’t building the resources into AssetBundles via Unity, but instead zipping up files. Is that right?
Is there a process for opening these manually zipped files from Unity code? Do you unzip them and put the files somewhere on the device and then access them from that unzipped location?
How do you generate the GUID if making these manual archives? Does the GUID file get generated somewhere in the build and I can just copy it over?
Sorry for all the questions. I feel like I’m close to understanding a process to follow
AssetBundle.LoadFromFile() can only load an AssetBundle file, e.g. from your description it should be able to load the “video” file you built. It should also work if it is renamed. However AssetBundle.LoadFromFile() doesn’t load obb files.
Regarding:
The “videos” files is large and I’m assuming contains all the Videos I specified for this AssetBundle.
Yes this makes sense. Fyi you can look inside your AssetBundle in various ways. In this case, using the Build Report Inspector after you run your build could be a convenient way to see some details of what is inside your build. There is also some AssetBundle summary reported in the Editor.log file.
I don’t know the answers to your question about obb workflows, but hope this is helpful from the AssetBundle side.
Hey Andrew, thanks for the response. It looks like I may be conflating two separate methods. Can I add a couple add on questions to your comment?
“I manually created an AssetBundle. The process creates these files: AssetBundles, AssetBundles.manifest, videos, videos.manifest. The “videos” files is large and I’m assuming contains all the Videos I specified for this AssetBundle.”
Do I need all 4 of these files need to be included or just the large “videos” file?
Would I place this/these file(s) in “Android/obb/com.myapp.demo”? Do I need to rename them at all?
Am I seeing this error because I’m trying to open an OBB with AssetBundle methods?
Unity : Unable to open archive file: /Android/obb/com.myapp.demo/patch.1.com.myapp.demo.obb
No, we don’t build asset bundles for our internal stuff, but we do pack resources to our own data files. If you want raw video files, put them to StreamingAssets instead.
If you search for files in Application.streamingAssetsPath, we search apk and all obbs as if it was a single directory. Caveat: there should be no duplicate files with the same name in different archives.
I don’t think we provide it anywhere. The GUID is in a file at the root of apk and each obb we produce, the contents of each file are supposed to be the same, that’s how we validate all came from same build.
No, we don't build asset bundles for our internal stuff, but we do pack resources to our own data files. If you want raw video files, put them to StreamingAssets instead.
Aren’t the concepts of OBB and StreamingAssets separate from each other? Or are you suggesting that I can access my manually created OBBs by using Streaming Asset codes? If I were to put these Videos in Streaming Assets in my project, how would I then submit those to the Android play store for example?
I’m a little confused here. I’m able to get Unity to generate the main.obb and it works fine. I just need additional patch.obb (or some other file type?) that include more video resources that I can access at runtime.
With the main.obb file that Unity produces when Split Application Binary is selected, there is no special code or anything needed to access those resources. It’s all handled behind the scenes. In contrast, if I’m generating my own patch OBBs, I’m not sure how to package them up and access them manually.
I don't think we provide it anywhere. The GUID is in a file at the root of apk and each obb we produce, the contents of each file are supposed to be the same, that's how we validate all came from same build.
Is there some procedure for producing the GUID when you manually create the OBB? In this case, I am trying to create my own OBB since Unity is only able to create the main.obb. I’m trying to add additional patch.obb.
On Android StreamingAssets are placed inside apk or obb without compression. We merge files from different archives into one virtual folder the Application.streamingAssetsPath gives you, so that should allow you to get file from assets directory of any obb.
I think the only way to get it is to unzip apk or obb from your last build. The GUID is different for each build.
Hey there, I’m facing the same problem @gtozzi is described, build obb file is abit above 5GB and the application seems to not start at all (3-dots loading black screen)
Have you figured it out?