Search Unity

Creating games for VR and non-VR users alike

Discussion in 'AR/VR (XR) Discussion' started by ryanreptoid, Jan 8, 2019.

  1. ryanreptoid

    ryanreptoid

    Joined:
    Aug 12, 2012
    Posts:
    82
    Hey gang. I'm working on a project that targets Oculus, Vive (through OpenVR), as well as keyboard & mouse/gamepad folks who have no headset. I'm using Unity 2018.3 and the built in XR 'virtual reality supported' features.

    Building a project that switches between these camera and control schemes seems straightforward enough; but Unity seems to run into some errors on machines that don't have any VR software/drivers.

    I get these warnings/error in Editor (on a mac with no VR)

    Warning:  Virtual Reality SDK Oculus failed to initialize. Will attempt to enable OpenVR instead.
    Error: XR: OpenVR Error! OpenVR failed initialization with error code VRInitError_Init_PathRegistryNotFound: "Installation path could not be located (110)"!
    Warning: Virtual Reality SDK OpenVR failed to initialize.
    Will attempt to enable None instead.


    and I get this error in the Player log from a built version (again, on the same no-VR computer)

    Plugins: Couldn't open /Users/redacted/other.app/Contents/Plugins/OVRPlugin.bundle/Contents/MacOS/OVRPlugin, error: dlopen(/Users/redacted/Builds/redacted.app/Contents/Plugins/OVRPlugin.bundle/Contents/MacOS/OVRPlugin, 2): Library not loaded: @rpath/LibOVRRT_0.framework/Versions/5/LibOVRRT_0
    Referenced from: /Users/redacted/Builds/redacted.app/Contents/Plugins/OVRPlugin.bundle/Contents/MacOS/OVRPlugin
    Reason: image not found


    I'm grateful this isn't a show stopper error and that the app still executes normally, but I'd like to skip loading the VR bundles/plugins and not look for path/drivers if none are detected.

    Any tips for getting Unity to more gracefully skip VR if no hardware is detected? I'd like to avoid making separate builds for each setup.

    Thanks!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    7,909
    I appreciate that you're including Mac users! :D I get the above warnings whenever I test my Oculus Go app within Unity (also on a Mac), but I just ignore them. But that's only testing — I can see why for shipping, you might want to eliminate them entirely.

    Unfortunately I don't know how to do that... I'm only responding to cheer you on!
     
    ryanreptoid likes this.