Search Unity

Cardboard VR build triggers GearVR

Discussion in 'AR/VR (XR) Discussion' started by jules_fpvr, Jan 3, 2018.

  1. jules_fpvr

    jules_fpvr

    Joined:
    Jan 8, 2016
    Posts:
    35
    I have a VR app I'm developing using Unity 2017.3.0p4. I have set it up to use the native Cardboard API (in Player Settings->Virtual Reality SDKs) but when I build/run the app and deploy it to my Samsung S7 it triggers the GearVR insert into headset instructions.

    I've tried removing Oculus from the PC target, deleting my AndroidManifest.xml, and deleting the whole OVR directory. I've also tried uninstalling the app from the phone before re-running the build/run.

    Whatever I do it seems to think it's a GearVR rather than Cardboard build.

    Does anyone hae any suggestions?

    Thanks

    Jules
     
  2. joejo

    joejo

    Unity Technologies

    Joined:
    May 26, 2016
    Posts:
    958
    If you can unpack the built APK, you can check to see if the Oculus manifest entry is still in the built product. If so, something in your project is still causing the Android build to think that Oculus us required and merging the manifest in. This could be because of Unity seeing a setting to tell it to include Oculus, or because some library/plugin in your project has it in their AndroidManifest.xml. It might help to export the project to Gradle and see if you can find the offending library.
     
    jules_fpvr likes this.
  3. jules_fpvr

    jules_fpvr

    Joined:
    Jan 8, 2016
    Posts:
    35
    Good suggestion. I've unpacked the APK and it has this line in the manifest:

    <meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>

    which definitely shouldn't be there. It's not in my original AndroidManifest.xml and it adds it if I don't have one.

    I'll try shutting down Unity and deleting my Library directory to force a complete rebuild and see if that helps.

    Good to know what's causing it and that it isn't my code or phone. Now just got to figure out what's causing Unity to want to add it.
     
    plmx likes this.
  4. jules_fpvr

    jules_fpvr

    Joined:
    Jan 8, 2016
    Posts:
    35
    @joejo I removed the Oculus Utilities plugin completely, deleted the library directory and then rebuilt and that seemed to solve the problem. Re-installing Oculus Utilities appears to break it again so it is reproducible. Right now I don't need Oculus utilities so I'll move on.
     
  5. skrpeta

    skrpeta

    Joined:
    Nov 9, 2016
    Posts:
    18
    Thanks @jules_fpvr. I had the same problem. Deleting library fixed it.
     
  6. mr_zog

    mr_zog

    Joined:
    Jan 21, 2014
    Posts:
    165
    Hi,

    thanks for the tip regarding looking at the built APK content.
    I exported a project and looked at the manifest and it seemed clean.

    The manifest of the built APK though had the "com.samsung.android.vr.application.mode" inside.

    Doing a search over the exported project again, it seems it' was located in:
    src\main\jniLibs\armeabi-v7a\libunity.so

    So back in Unity, deleting the file Assets/OVR/Plugins/1.20.0/Android/OVRPlugin.aar solved the issue for us!
    And it doesn't break the desktop build ... at least I hope so, haven't tested that yet o0

    Cheers!