Search Unity

Question How do I switch from old to new input based on whether the player has a VR HMD or not?

Discussion in 'VR' started by soleron, Feb 17, 2021.

  1. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    582
    How can I automatically switch from the new Input that OpenXR requires, to the Old input that my FPS controller requires?

    I want the user to be able to explore the area even without a VR headset. In a traditional FPS way.
    However the asset I have uses the old input style.

    I do not want to trouble the user, the switch should be transparent. Is there a simple way to do it?

    Thank you.
     
  2. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    When setting the input system you can choose to use both the new and the old input system. If you do that I think your old asset and OpenXR should live happily together.

    Project Settings -> Player -> Other Settings -> Active Input Handling (Both)
     
    soleron likes this.
  3. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    582
    Thanks. I found out by accident while I was looking for something else.
    Indeed it works.
     
  4. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    582
    @the_real_apoxol is there a way to automatically switch between VR and non VR mode ? or is it only possible as a setting?
     
  5. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    141
    Wouldn't it be better to unify the two, and rewrite the input requests in the FPS controller to just use the input system?
     
    soleron likes this.
  6. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    582
    For me this is not possible. In the past I would use the very nicely made OpenVR system from Valve that automatically falls back to FPS if the user does not have VR hardware connected and everything would work like a charm.

    Unity has messed all this up for the last year and have blown their partnerships out of the water So I am trying to find ways to do that in the new versions of Unity, because the old ones do not support HDRP in VR: So I either have to use an old version of Unity with crappy visuals OR use the new Unity and pull the quality my users expect, but stumble on the lack of properly and thoughtfuly designed systems by professionals that would make these ridiculously basic functions a breeze for everyone. OpenXR does not support SteamVR... so I suppose my choices are to either deliver crap, or drop the project and lose money :D
     
  7. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    141

    I'm sorry what? Valve is a Promoting member of the Khronos Group, and has been transitioning to OpenXR since june last year. Unity's OpenXR plugin has supported Vive and Index HMD and controller input since the start (albeit with the same limitations as other headsets at the moment).
     
  8. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    I believe you can uncheck the "Initialize XR On Startup" in the XR Management settings and then manually start and stop the XR loader as you need. I have not personally tried this but I believe that is the correct way to do it. I found some documentation here https://docs.unity3d.com/Packages/c...@3.0/manual/EndUser.html#automatic-xr-loading that mentions how to do this.
     
    soleron likes this.