0

Hi guys I am making a game in which i have both first person mode and VR mode.

Till now i am able to select VR mode correctly but after returning to the main menu my game just freezes i don't understand why ?

I am using unity GUI for my menu and i am also using virtual reality tool kit(VRTK).

Things work fine when i first select FPS mode from the menu and then return and select vr then it works fine but when i go back from vr mode it stuck.

I have observed that when I select VR mode the unity UI standalone Input Module class shuts down so I enabled it then UI works but still game freezes

This is the code I am using to turn the device on

//StartCoroutine(VRSpecificSettings_Ref.LoadDevice("OpenVR")); this line for VR Player
//StartCoroutine(VRSpecificSettings_Ref.LoadDevice(""));  this for non VR

    public IEnumerator LoadDevice(string newDevice)
    {

        VRSettings.LoadDeviceByName(newDevice);
        yield return null;
        if (newDevice != "")
        {

            VRSettings.enabled = true;
            GameObject go = GameObject.Find("SpawnPoint");
            vrClone = Instantiate(VRPlayer, go.transform.position, Quaternion.identity) as GameObject;
            ActivateIconsVR();

            Invoke("invokeIT", 1.0f);

        }
        else
        {
            VRSettings.enabled = false;
        }
    }
Syed Anwar Fahim
  • 306
  • 5
  • 15
  • @Programmer have you read the question before duplicating it i have a issue after i switch i am successful in switching no help need from you there but my problem is after switching and if you are reading this then plz do not be over efficient and read the whole question first Wasted my time – Syed Anwar Fahim Aug 11 '17 at 13:42
  • Yes, I read it before closing it. I think you should remove every code that is inside the `if` statement and before `VRSettings.enabled = true;`. Put them before `VRSettings.enabled = true;`. I do think they contribute to this. – Programmer Aug 11 '17 at 13:48

0 Answers0