oculus-samples / Unity-DepthAPI

Examples of using Depth API for real-time, dynamic occlusions
Other
167 stars 24 forks source link

Build Issue #33

Closed Androrugby closed 3 weeks ago

Androrugby commented 3 months ago

Hello, when I try to build, the DepthAPI seems to only work on the device where I build it; if I try to download the app on another device, it doesn't work. I believe it might be due to some permissions in developer mode. I have also added several permission requests in the manifest, but I'm not sure if that's enough or if something is simply missing. Does anyone know what this might depend on? Here's a copy of my manifest:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
  <application android:label="@string/app_name" android:icon="@mipmap/app_icon" android:allowBackup="false">
    <activity android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:launchMode="singleTask" android:name="com.unity3d.player.UnityPlayerActivity" android:excludeFromRecents="true" android:exported="true">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <category android:name="com.oculus.intent.category.VR" />
      </intent-filter>
      <meta-data android:name="com.oculus.vr.focusaware" android:value="true" />
    </activity>
    <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
    <meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only" />
    <meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2|questpro" replace="android:value" />
  </application>
  <uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
  <uses-feature android:name="oculus.software.handtracking" android:required="false" />
  <uses-permission android:name="com.oculus.permission.HAND_TRACKING" />
  <uses-feature android:name="com.oculus.experimental.enabled" android:required="true" />
  <uses-permission android:name="com.oculus.permission.USE_ANCHOR_API" />
  <uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="true" />
  <uses-permission android:name="com.oculus.permission.USE_SCENE" />
</manifest>
TudorJude commented 3 months ago

Hello Androrugby,

It's very likely related to the permission, yes. You need "com.oculus.permission.USE_SCENE" but you also need to request the permission for the app. To check this simply go to your device's settings -> Apps and make sure "Spatial data" is turned on for your app.

Androrugby commented 3 months ago

Hello @TudorJude , thank you for your response! I wanted to ask if there's a way to obtain this permission automatically. The 'com.oculus.permission.USE_SCENE' is already present in the manifest, but I would like the user, once they download the app, to only have to accept the permissions through the usual pop-ups upon first launch.

PS: I'm not sure if I misunderstood your response, in which case, I apologize :sweat_smile:

TudorJude commented 3 months ago

There's a difference between adding the permission in the manifest and explicitly asking for it. When it's in the manifest, that means that the app can ask for it but not that it will automatically ask for it. As a developer you also need to ask it from the user. The most general use case is that you ask for the permission when the app starts, but the best use case is to ask for any permission when you explicitly need the user to grant that permission. For the first use-case (which is probably what you need from what I understand) you simply go to OVRManager and set this toggle to true:

image

This will ask for the user to grant scene permission on start-up.

Androrugby commented 3 months ago

I managed to have the permission request on the first app launch (I don't know how I didn't see it before, thanks). However, in the build, I still can't see any objects. Could it be due to something else?

TudorJude commented 3 months ago

Is the other device a quest 3?

Androrugby commented 3 months ago

Yes, is a Quest 3

TudorJude commented 3 months ago

Do you have access to the second device? Can you get some logs from it?

Androrugby commented 3 months ago

These are the logs that I managed to extract, it's quite long, I'm sorry but I don't know which part might be useful to you. However, I see there's this error called by DepthAPI: 15:10:26.528 20781 20799 W Unity: DepthAPI: no environment texture

odh_logs_2024-04-02_13.10.40.131.txt

TudorJude commented 3 months ago

That's the warning I was looking for. Unfortunately, there aren't many other exposed errors/warnings to explain as to why there is no environment texture available. Firstly, I'd double check that on the device with the issue Spatial Data is turned on for the app. Settings -> Apps -> Permissions -> Spatial Data and check that your app has the toggle set to on. Second, did you upgrade to core v62? There was another thread on here that had a similar issue.

Androrugby commented 3 months ago

Currently, the version in use on the device is v63 and the spatial data permission is active for the app. These are the logs with v63 installed, perhaps there is some new information, I wouldn't know.

odh_logs_2024-04-02_14.53.41.042.txt

TudorJude commented 3 months ago

Can you enable experimental on the problematic device? it's an adb command

adb shell setprop debug.oculus.experimentalEnabled 1

The feature should be out of experimental, so I am not expecting this to work, though, but I'm running out of ideas.

Androrugby commented 3 months ago

No, indeed it doesn't seem to work the same... Is it possible that I don't have an updated version of the package? How can I check what the correct version is?

TudorJude commented 1 month ago

Hello,

Are you still encountering this issue?

TudorJude commented 3 weeks ago

Closing due to inactivity.