To get the directory it's saved in use context.getObbDir() So it's best to just try and ask for permission if trying fails. Some android versions and some devices in other versions (it sounds like it's a bit of a crapshoot to be honest), you need permissions to read the file, while in others you don't. Once you've done that, you need to get the path to the file, and request permission to read it if needed. I think the documentation for that is moderately straight forward (and if you have issues I'd recommend asking a new question specific to it. I'd recommend using the Download Library they provide as there's all sorts of things to worry about like the device running out of storage, network connectivity, showing progress, etc. According to the android documentation, you can't guarantee that they will have been so you need to write the logic to download them. On the android side the first thing you need to do is make sure your app actually has the files downloaded. What you'd do to start is set up a method channel to initiate this process and call it with something like getObbFolder. The documentation probably does a better job of explaining platform channels than I do, but basically the easiest way is to use a MethodChannel to pass data from dart to native and vice-versa. It's not prohibitively difficult, it just means that you're going to have to learn about Platform Channels and write a bit of native android code. Basically, until someone implements a plugin to access APK expansion files, you're going to have to write the java code to connect up to Flutter. Attempting to load the full obb path manually and appending '!/assets/bundles/.' did not work either.You're going to have a little bit of fun with this. I can only assume that the '!' is handled magically by something in the file loader, but am not sure of it's function. Jar:file:///data/app/-GUIDHERE=/base.apk!/assets/bundles/android/default_bundle.bundle assets/bundles/android/our_bundle.bundleĪnd our loading code is simply: AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "/assets/bundles/android/our_bundle.bundle")) The android manifest does have READ_EXTERNAL_STORAGE permissions.Ĭomparing the apk and obb files show they both have the same file structure: The obb file is confirmed on-device at: /sdcard/Android/obb//. Is this definitely the correct way to be doing this? How exactly does the loading logic find the asset bundles inside the obb? How does it do a name lookup or is it just scanning the guid files inside? Does the 'main' part of the obb filename have some particular importance? Loading our asset bundle through AssetBundle.LoadFromFile() fails. We are using Split Application Binary to generate an. If you place your bundle in streaming assets, then simple append the relative path to bundle to Application.streamingAssetsPath and it should load. I have in my androidmanifest.xml and can confirm when i go to the apps page on the quest that the permissions are allowed.Ĭan anyone explain to me why it can't read this obb file?īoth UnityWebRequest and AsseBundle APIs can load from inside obbs. I have the unity console error messages outputting to a text object for troubleshooting and I get the error -įailed to read the data from AssetBundle. I can confirm the file path is correct (using - and i can see it in the correct location on my quest headset when i plug it into my pc) In the first scene on the awake method of an game object I call the method:ĪssetBundle bundle = AssetBundle.LoadFromFile(path) When I install the app from app lab is downloads the OBB and places it in the expected folder - something like - "/sdcard/Android/obb//main.1." The obb is generated and uploaded with the apk to Oculus App Lab without issues. I am using the "Split application binary" option for an android app (oculus Quest). Not sure if this is the right sub forum for this since its not referencing Addressable but.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |