Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Resolved Loading OBB on Android/Quest

Discussion in 'Scripting' started by Swisheh, Mar 31, 2021.

  1. Swisheh

    Swisheh

    Joined:
    Mar 28, 2017
    Posts:
    5
    Hi all,

    I've been trying to load my OBB file following a bunch of different guides, but I keep running in to errors that don't seem to be solved anywhere.

    Currently I've followed all steps at https://developer.oculus.com/blog/tech-note-expansion-files-with-unity/ and I can see my installed files and the obb, but when I run my app with debugging I get:

    AndroidPlayer(samsung_SM-G981B@192.168.1.213) Unable to open archive file: /storage/emulated/0/Android/obb/main.1.com.VS.Test.obb

    I've tried a couple different approaches, including using UnityWebRequestAssetBundle (this resulted in "Curl error 37: Couldn't open file")

    Using Unity 2019.4.20f1 and building for Android.

    Any ideas of where I should look?

    Thanks~
     
  2. Swisheh

    Swisheh

    Joined:
    Mar 28, 2017
    Posts:
    5
    I think I solved the problem today. Will be able to test after the long Easter weekend.
    This at least removed the red flags I got when building to my Android phone and my package contents was being loaded.

    When following the Oculus guide change the Java helper from
    Code (JavaScript):
    1. return  storageDir + File.separator + "Android" + File.separator + "obb" + File.separator + "main." + version + "." + packageName + ".obb";
    To

    Code (JavaScript):
    1. return  storageDir + File.separator + "Android" + File.separator + "obb" + File.separator + packageName + File.separator +  "main." + version + "." + packageName + ".obb";

    and make sure to push the OBB file into the folder for your package
    eg.
    /storage/emulated/0/Android/obb/main.1.com.VS.Test.obb becomes
    /storage/emulated/0/Android/obb/com.VS.Test/main.1.com.VS.Test.obb

    The only other part I did different was using the AssetBundle Manager to rebuild my OBB.
     
    YrbOy23 likes this.