Search Unity

Round trip VR/no-VR doesn't work : controllers bug :(

Discussion in 'AR/VR (XR) Discussion' started by basteos, Jul 16, 2019.

  1. basteos


    Mar 12, 2019
    Hi everyone,

    In my house design project, you can at the end activate a VR mode (and take HTC Vive Headset and one controller) to visit the house you designed. It works.Then, you can leave this VR mode with a button and go back to computer to change something (for example a door). It works.But when you re-activate VR mode and to visit again, I don't know why but there is not any controller. Headset works, you can see, rotate on yourself, etc. But the controller is fixed in its world position, it doesn't move or take any touch events.

    I use SteamVR and OpenVR (HTC Vive). My transition is done just by deactivating the main camera and enabling Player and Teleporting SteamVR prefabs.

    The strangest thing is : It works in editor play mode, but doesn't when it's build (Controllers work only one VR time)

    To activate :

    Code (CSharp):
    1. MainCamera.SetActive(false);
    2. yield return new WaitForEndOfFrame();
    3. XRSettings.LoadDeviceByName("OpenVR");
    4. yield return new WaitForEndOfFrame();
    6. XRSettings.enabled = true;
    7. PlayerVR.SetActive(true);
    8. TeleportVR.SetActive(true);
    To deactivate :

    Code (CSharp):
    1. PlayerVR.SetActive(false);
    2. TeleportVR.SetActive(false);
    4. XRSettings.LoadDeviceByName("None");
    6. yield return null;
    8. XRSettings.enabled = false;
    10. MainCamera.SetActive(true);

    Did someone develop a program where you could go to VR and back to no-VR as many times as you want ?

    Last edited: Jul 18, 2019