How do I get Oculus to access an External Drive through Unity?

47 views Asked by At

So I've been trying to get my Oculus Quest 2 to access data from an external drive through Unity. The external drive is plugged into my Mac, and when I hit play in the Unity Editor, my code works fine. However, when built into the Oculus, I get errors saying the file isn't found.

This is my code:

if (!Permission.HasUserAuthorizedPermission(Permission.ExternalStorageRead))
{
    Debug.Log("Permission set?");
    Permission.RequestUserPermission(Permission.ExternalStorageRead);
}

string[] args = new string[] { "v", "*path file*" };
if (args.Length > 1 && System.IO.Directory.Exists(args[1]))
{
    directory = args[1];
    have_directory = true;
    Debug.Log("Valid directory specified!");
    if (args.Length > 2)
    {
        current_frame = int.Parse(args[2]);
    }
}
else
{
    Debug.Log("No directory found :(");
    return;
}

And this is my manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.UnityTechnologies.com.unity.template.urpblank"
android:versionCode="1"
android:versionName="0.1.0"
android:installLocation="auto">
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
<application>
<meta-data android:name="com.oculus.intent.category.VR" android:value="vr_only" />
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2|cambria" />
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
<activity android:screenOrientation="landscape"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
android:launchMode="singleTask"
android:name="com.unity3d.player.UnityPlayerActivity"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="com.oculus.permission.READ_VR_DEVICE_PARAMS" />
<uses-permission android:name="com.oculus.permission.SET_VR_DEVICE_PARAMS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

If anyone has an ideas or workarounds, any help would be appreciated! Thank you!

The code works when I run it locally on my Mac through the Unity Editor so the file does exist at the appropriate path. The Oculus just can't find it :(

0

There are 0 answers