Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
XNW's avatar
XNW
Honored Guest
4 years ago

Meta Avatar SDK with Obb file

Recently, our team started to use obb file as the apk file is getting bigger and bigger. After using obb, our meta avatar doesn't load correctly, and we get these errors: 

[ovrAvatar2 native] AssetLoaderZip::Failed to open asset zip file: Oculus/OvrAvatar2Assets.zip
[ovrAvatar2 native] Loader::Could not load Oculus/OvrAvatar2Assets.zip as zip source
[ovrAvatar2 native] SystemAndroid::Application will not be able to use a shared asset cache because it does not have Manifest.permission.READ_EXTERNAL_STORAGE and/or Manifest.permission.WRITE_EXTERNAL_STORAGE permissions.

But we do have 

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

in our AndroidManifest.

 

And also, we found the OvrAvatar2Assets.zip in Obb file.

 

Does anybody have this problem too or is able to help?

5 Replies

  • Have you had any further progress with this?

     

    We're facing similar issue - for us it's avtars locked in some odd pose. I'd imagine with assets-file now being in OBB, addressing is broken. 

     

    Can't think this was not initially thought of by developers and there should be some easy fix? Nothing in the docs that I could find though.

  • For anyone looking at this.

     

    On my end Quest2 local avatars failed to load for with error:
    [ovrAvatar2 entity] Failed to load asset. NotFound at path: 0_quest.glb

     

    now quite intestingly it looked like the whole zip was loaded fine with:
    [ovrAvatar2 native] Loader::Added Oculus/OvrAvatar2Assets.zip as zip source


    Digging further:
    - zip file load on quest done via Oculus.Avatar2.OvrAvatarManager.AddRawZipSource was forced to load PresetAvatars_Quest2.zip (this bit will be resolved in code based on runtime platform [Quest/Quest2/Rift])
    - then it tries to load glb (in our case that was 0_quest.glb), in this case _quest.glb is a specified postfix. This is default postfix in OvrAvatarEntity
    - when you're running it on Quest2 it'll load glbs from PresetAvatars_Quest2.zip file, if you look into the zip you'll find that postfix there is _quest2.glb. Chaning that sorts the issue for this platform

    I think it was broken for us at some point with Avatar plugin update, previously preset avatars were in 2 zips, one for Quest and one for Rift, now that they differentiate it seems script is broken. Without custom change to OvrAvatarEntity there's little you can do to grab correct postfix.

  • Having same issue - In UNITY 2021.3.4f1

    - [ovrAvatar2 native] loader::Could not load "C:/...\\PresetAvatars_Rift.zip" as zip source

     

    - [ovrAvatar2 manager] Error AddZipSourceFile NotFound. Path was C:/Users/*********/Assets/StreamingAssets\SampleAssets/PresetAvatars_Rift.zip
    UnityEngine.Debug:LogError (object,UnityEngine.Object)

     

  • Same Problem here but with different file:

     

    [ovrAvatar2 native] AssetLoaderZip::Failed to open asset zip file: SampleAssets/PresetAvatars_Quest.zip

     

    The OculusAvatarmanager contains the list: PreloadZipFiles. The zip files provided here are located in: Assets/Oculus/Avatar2/StreamingAssets/.  

     

    Unity documentation says that when using .obb files the StreamingAssets Folder is located inside of the .obb file, and you should use unities: UnityWebRequest to read them correctly. 

    https://forum.unity.com/threads/obb-file-as-streaming-asset-for-android.1071137/

     

    Oculus is using native code to load this .zip files, which seems to work correctly without .obb files but fails when the streaming asset folder is inside the .obb file.. 😕 This is my guess. 

     

    Since the loading code is native i have no idea how to fix/workaround this.

    I just submitted a bug report. Lets hope for a fast answer.. 

  • OK i was able to workaround the problem with a small hack.. 

     

    The avatarSDK expects to find the folders assets/Oculus and assets/SampleAssets inside of the apk. When using .obb files this folders are placed inside the .obb file so the sdk cannot find them anymore. We workarounded this problem by putting this file into the .apk again after building it in unity.

     

    1) So first we built the project without .obb support. Renamed the .apk to .zip, opened it and copied the two folders: assets/Oculus and assets/SampleAssets to some other directory.

    2) We built the project with .obb support.

    3) We decompiled the .apk using "apktool d ourprojectname.apk"

    4) We copied the two folders back to the expected locations inside of the decompiled .apk: assets/Oculus and assets/SampleAssets

    5) We rebuild the apk using "apktool b ourprojectname.apk"

    6) we resigned the .apk using "apksigner sign --ks ourkeystorename.keystore ourprojectname.apk"

     

    This is not a very clean solution and the folders assets/Oculus and assets/SampleAssets will be inside of the .apk and inside of the .obb but we finally are able to use the new avatarsystem together with .obb files.