Search Unity

dataPath folder to obb

Discussion in 'Android' started by paulatwarp, Sep 11, 2019.

  1. paulatwarp

    paulatwarp

    Joined:
    May 17, 2018
    Posts:
    135
    I'm building a Unity project with an obb expansion package.

    According to the docs:
    https://docs.unity3d.com/2018.4/Documentation/ScriptReference/Application-dataPath.html

    Android: Normally it would point directly to the APK. The exception is if you are running a split binary build in which case it points to the the OBB instead.

    However, for me it is pointing the the APK:
    /data/app/com.oculus.game-1/base.apk

    I'm building using Unity 2018.2.20f1 targeting the Quest.

    Any ideas?
     
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    836
    Hi, this happens when OBB can't be loaded during the runtime. Do you heave READ_EXTERNAL_STORAGE permission in the manifest? Is that permission granted?
     
    paulatwarp likes this.
  3. paulatwarp

    paulatwarp

    Joined:
    May 17, 2018
    Posts:
    135
    Where is the manifest?
     
  4. paulatwarp

    paulatwarp

    Joined:
    May 17, 2018
    Posts:
    135
    I clicked the box to Export Project. In there I found AndroidManifest.xml, I'm guessing that's what Unity is using internally?

    In that file it has the permission:
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    Where should I be putting the obb file? Currently I'm putting it in:
    /sdcard/Android/obb/com.oculus.game
     
  5. paulatwarp

    paulatwarp

    Joined:
    May 17, 2018
    Posts:
    135
    To answer my own question... again...

    You can't just load the obb file into the folder, you have to rename it as well.

    Code (csharp):
    1. adb push -p game.main.obb /sdcard/Android/obb/com.oculus.game/main.1.com.oculus.game.obb
    What do you mean you couldn't just guess that?
     
  6. PKSiuBad

    PKSiuBad

    Joined:
    Dec 8, 2014
    Posts:
    2
    hi, i find the datapath point to apk. i have the permission, but I am export project to build android apk.
    I try to unity build, the path of the obb is the same, but the datapath point to obb
     
  7. PKSiuBad

    PKSiuBad

    Joined:
    Dec 8, 2014
    Posts:
    2
    hi, i find the datapath point to apk. i have the permission, but I am export project to build android apk.
    I try to unity build, the path of the obb is the same, but the datapath point to obb
     
  8. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239
    I'm having the same issue, except I'm using Build & Run so Unity should be naming the OBB for me. I've examined the manifest and it looks to have the required permission. However, my dataPath is unchanged and our game can't load anything from the OBB.

    Unity: 2020.3.18f1


    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <!-- GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN-->
    3. <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools">
    4.   <application>
    5.     <activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" android:screenOrientation="reverseLandscape" android:launchMode="singleTask" android:maxAspectRatio="16.9" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:resizeableActivity="false" android:hardwareAccelerated="false">
    6.       <intent-filter>
    7.         <action android:name="android.intent.action.MAIN" />
    8.         <category android:name="android.intent.category.LAUNCHER" />
    9.       </intent-filter>
    10.       <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    11.       <meta-data android:name="android.notch_support" android:value="true" />
    12.     </activity>
    13.     <meta-data android:name="unity.splash-mode" android:value="0" />
    14.     <meta-data android:name="unity.splash-enable" android:value="True" />
    15.     <meta-data android:name="android.max_aspect" android:value="16.9" />
    16.     <meta-data android:name="unity.allow-resizable-window" android:value="False" />
    17.     <meta-data android:name="notch.config" android:value="portrait|landscape" />
    18.     <meta-data android:name="unity.build-id" android:value="a78a39c7-c8b9-4f6a-a60f-2a6835cf5af2" />
    19.   </application>
    20.   <uses-feature android:glEsVersion="0x00030000" />
    21.   <uses-feature android:name="android.hardware.vulkan.version" android:required="false" />
    22.   <uses-permission android:name="android.permission.INTERNET" />
    23.   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    24.   <uses-feature android:name="android.hardware.touchscreen" android:required="false" />
    25.   <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
    26.   <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
    27. </manifest>
     
  9. VoodooDetective

    VoodooDetective

    Joined:
    Oct 11, 2019
    Posts:
    239