Search Unity

Oculus Unity Preview Problem: oculus.exe is taking a while to load

Discussion in 'AR/VR (XR) Discussion' started by hhassan1230, Oct 26, 2017.

  1. hhassan1230

    hhassan1230

    Joined:
    Jan 9, 2016
    Posts:
    5
    I am having trouble previewing my project in Unity using my Oculus. I have Unity 2017 and my Oculus App runs all of my VR apps except for unity.exe
    I have my Oculus permissions set to allow 3rd party apps. I Googled this problem for 3 days with no solution only this thread (https://forum.unity.com/threads/editorvr-not-loading-in-oculus-headset.451508/).

    Would anyone understand why this happening?

    Thanks
     
    Last edited: Nov 9, 2017
    CloudyVR likes this.
  2. brc51

    brc51

    Joined:
    Feb 14, 2015
    Posts:
    4
    I have exactly the same problem. As you, I have set my Oculus settings to allow for 3d party apps not approved by Oculus, I have had Oculus work once out of maybe 20 attempts with Unity. Why it worked that one time, I have no idea.
    I have played with the XR settings C#. The following always returns "VR is NOT enabled." If the line XRSettings.enabled = true; is uncommented, Unity crashes.

    IEnumerator LoadDevice(string newDevice)
    {
    XRSettings.LoadDeviceByName(newDevice);
    yield return null;
    Debug.Log(string.Format("XRSettings.loadedDeviceName={0}\n", XRSettings.loadedDeviceName));
    //XRSettings.enabled = true;
    //yield return null;
    if (UnityEngine.XR.XRSettings.enabled == true)
    {
    UnityEngine.XR.InputTracking.Recenter();
    bool isSuccess = UnityEngine.XR.XRDevice.SetTrackingSpaceType(UnityEngine.XR.TrackingSpaceType.Stationary);
    Debug.Log(string.Format("SRSettings.enabled={0} is Stationary={1}\n", UnityEngine.XR.XRSettings.enabled.ToString(), isSuccess));
    }
    else
    {
    Debug.Log(string.Format("VR is NOT enabled.\n"));
    }
    }

    This information is probably of little use to you -- other than knowing you are not alone. Unity version 17.2.xxx (multiple ones)
     
  3. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    715
    I recently purchased an Oculus cv1 during a BlackFriday sale. I have been trying to get it to work in Unity since. I get a similar message in the headset saying "Unity.exe is taking too long", but Unity shows that the game is running, even weirder is that the head and hand tracking are working fine. Here's some details on the issue I'm experiencing.

    I also have a Vive, so my project uses SteamVR and OculusSDK, what SDK are you using?
     
  4. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    715
    Just came across something interesting, I noticed that in one of the project's configuration files there is a line that Unity inserts whenever it is closed or the project is saved. Whenever this line is present, my Oculus headset generates the message, however when the project is closed, then that line is removed, I can re-open the project and the scene loads normally.

    ProjectSettings/ProjectSettings.asset
    From:
    Code (csharp):
    1.   m_BuildTargetVRSettings:
    2.   - m_BuildTarget: Standalone
    3.     m_Enabled: 1
    4.     m_Devices:
    5.     - None  //REMOVE THIS ENTRY
    6.     - Oculus
    7.     - OpenVR
    To:
    Code (csharp):
    1.   m_BuildTargetVRSettings:
    2.   - m_BuildTarget: Standalone
    3.     m_Enabled: 1
    4.     m_Devices:
    5.     - Oculus
    6.     - OpenVR
    Also if there are multiple options in that list, be sure that Oculus is the first, as this did seem to make a difference in my case.
     
  5. brc51

    brc51

    Joined:
    Feb 14, 2015
    Posts:
    4
    trappist1 -- I used your suggestion of exporting the Unity project for which I could not startup Oculus. I then imported the export into a new project. That fixed the problem of starting Oculus. Thanks for the suggestion!
     
    CloudyVR likes this.
  6. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    715
    Not sure if this will be of interest to anyone, but here's some additional info from a thread I started on VRTK.
    Specifically, check out the last post by bddckr.
     
    Last edited: Dec 4, 2017