04-13-2018 01:18 PM - edited 04-13-2018 01:30 PM
We're working on a Unity app that uses the raw data from the Vive Focus cameras to show a "camera passthrough" experience. We use this to help the user set up our app and configure it if they're having trouble with it.
We used the camera passthrough sample that came with the SDK (unity plugin), and it mostly works great. But occassionally the camera data just stops working in certain builds, and we're having a very difficult time detecting what's going wrong. Here's our experience:
We maintain an archive of all of our builds, and when we load old builds, camera DOES work. But when we re-compile the code for those same builds, then it breaks again. There must be something outside of our source control that we're not aware of that is affecting camera. Maybe it's a bug in the build system?
When I look at the logs I don't see a clear error that seems related to the camera functionality. Is there a particular keyword that I should search for in the logs that might help me troubleshoot this?
Other things we've tried:
This does seem like a bug with the build system. Any other ideas on how to solve this?
Solved! Go to Solution.
04-25-2018 08:06 AM
Recently got my hands on Focus and playing with Unity, seems like I may have same problem, camera didn't work from the start even on examples. What I did basically is load CameraTexture_Test example scene, looked at the white cube, realized that I currently have no camera permissions, got them through PermissionMgr_Test example, tried to load CameraTexture_Test back just to find that it is not working anymore. ~5 seconds of completely black screen after Unity logo and then autoexit to launcher.
Unity 2017.4.0f1, wavesdk 2.0.32, ROM 1.21.1405.1
Don't know how to check logs yet.
04-26-2018 01:12 PM
I attached two logs. One from a build where the camera works, another from a build where the camera doesn't work. When the program boots up, I print the message "WE DID IT!" to the log, so you can search for that as a marker.
I'm using Unity version 2017.3.1f1. Our app overrides the default Android activity (we made sure to extend WVRUnityVRActivity), both builds do this. Specifically we create an AAR file in android studio that contains our custom activity, we import that into Unity, and in Unity we configure the Android build system to use Gradle instead of "Internal" (internal runs into manifest merge issues on activity names even though the activity that triggers the error has identical package names in both manifests)
05-03-2018 09:23 PM
Please check if you include permission request code before you initial camera.
Let us know if it's resolved on your side.
05-07-2018 04:47 PM - edited 05-07-2018 04:47 PMSolution
Thanks! The problem was in fact the permissions. We had defined it in the manifest, but they weren't auto-granted.
For troubleshooting, a quick workaround is to go into Android system menu > apps > [our app] > permissions, and then grant the camera permission manually. When installing the APK over ADB, you can add -g option to auto-grant all runtime permissions.
For production, you can use the WaveVR SDK sample called "VR Permissions" to display an android system prompt to the user asking for them to grant the app the appropriate permissions.
05-07-2018 07:46 PM
@Livio thanks for your great summary for both trouble shooting and formal design. I believe it's very helpful for many developers.
05-10-2018 08:05 AM
Played a little more with the rawdata and found the following:
CameraTexture is working for me as far as "Development build" option is unchecked. Which pretty much proves that I did all permissions stuff right, if I understand correctly. If I check "Development build" before building, app crashes when I'm enabling GameObject which has CameraTextureSample.cs on it, or instantly, if it is enabled from the start.
I also found another scenario. After reloading scene (by
), it also crashes on making Gameobject with CameraTexture active.
Message me if more info required to reproduce that behaviour
02-09-2019 06:39 AM
I am having the same issue with the crash of CameraTexture_Test scene when development build is ticked.
How did you resolve the problem? I am running Wave SDK 2.1.8 on Unity 2018.3.0f2