Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice
  2. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Unity Play mode not rendering in VR headset.

Discussion in 'AR/VR (XR) Discussion' started by alexchesser, Oct 23, 2019.

  1. alexchesser

    alexchesser

    Joined:
    Sep 15, 2017
    Posts:
    147
    Hey There,

    has anyone had the problem of their unity VR project not showing up in the RIFT headset while running in the Unity Editor's play mode?

    The VR project works exactly as intended when I build and run on a an occulus quest.
    It runs exactly as intended when I build and run on a PC: a razer laptop + Rift (not s)

    But when in the unity editor - if I hit play - it does NOT show up in the RIFT headset.

    I am currently using unity editor 2019.2.9f1

    there are two SDKs installed under player settings: Occulus and OpenVR with occulus first.

    I hear from other people that this seems to be a thing that "just works" for them - or has in the past.

    Is there something simple I'm missing? A package or checkbox that says "show development in the headset"?
     
  2. alexchesser

    alexchesser

    Joined:
    Sep 15, 2017
    Posts:
    147
    OK - for anyone in future who finds this ... I deleted the Virtual Reality SDKs ... turned VR off. Ran the editor once.

    Then turned VR back on, re-added the SDKs and it worked again.

    essentially "have you tried turning it off and on again?"
     
  3. JoelGab

    JoelGab

    Joined:
    Jul 17, 2018
    Posts:
    25
    We are experiencing this same issue, the VR preview in the game view shows what we should see in the oculus headset, but the headset is rendering nothing. We will try the 'off and on' solution.

    One interesting thing is this was only happening in editor, and now as of the last build, it also happens in the build.
    The only thing I can pin it to is it happens more frequently if the VR headset isn't engaged (sensor triggered and display on) when you click play.

    We also occasionally experience black pixel like artefacts from within the headset, but not in the VR preview when observing through unity.

    We are on Unity 2019.2.4f1 and using the Oculus (Desktop) and OpenVR (Desktop) packages.
     
    alexchesser likes this.
  4. alexchesser

    alexchesser

    Joined:
    Sep 15, 2017
    Posts:
    147
    I can confirm that I've also seen those black pixel artifacts, though it has been very rare for those. Most recently, (yesterday) I had a single large black box overlay the viewport in both eyes in the headset while nothing was visible on the output.

    Like it was an alert box that was stuck or something. It appeared immediately after upgrading the oculus desktop software version and was fixed by uninstalling and reinstalling oculus desktop software.

    As for the unity editor/play mode thing it just wound up being sporadic and "fixed itself" for a few days, then stop by and say hi for an hour or two... rinse and repeat.
     
  5. JoelGab

    JoelGab

    Joined:
    Jul 17, 2018
    Posts:
    25
    Glad to hear I'm not the only one. Yeah, it is a very sporadic issue on our end too, which makes it even scarier.

    It's only recently that we started seeing it happen more frequently, and now every build will have the issue `occasionally`. Sometimes it will open without artifacts, and then, in a seemingly random circumstance, decide to bug out again.

    One thing I am doing is handling the VR SDK loading myself, as it is a desktop/VR application that only needs VR in a specific scene, so my 'Virtual Reality SDKs' list starts with none. I'm also in singlepass.

    Did you do anything on your end that may have indirectly fixed this issue like upgrading unity and/or downgrading unity or the oculus (Desktop) package?

    I'm starting to think it's simply due to the Oculus (Desktop) package being too far behind the current Oculus Plugin, which might be why this problem is escalating as the Oculus Software updates and evolves.
     
  6. JoelGab

    JoelGab

    Joined:
    Jul 17, 2018
    Posts:
    25
    Maybe I could manually replace the OVRPlugin provided by the oculus desktop package cache and see if that resolves the issue, I'll let you know if I have any luck.
     
  7. JoelGab

    JoelGab

    Joined:
    Jul 17, 2018
    Posts:
    25
    MY SOLUTION BELOW:

    @alexchesser I think I may have found out why this happens. I'm fairly sure this has something to do with delaying the activation of an object that has the VR camera. Potentially is to do with VR loading, while no cameras setup for VR are enabled.

    I thought at first the issue might be related to hierarchy depth, but testing in isolation proved this to be incorrect.
    However, If I turn off the VR rig game object, and write a script that delays the activation of the game object, I can recreate the issue frequently (not consistently, but it happens often). When I make sure the object with the VR camera, no matter what, is on by default, I have never had the issue arise (As of yet, hit play over 30 times and no black screen or black pixel artifacts). When turning back on the delayed activation, it happened very frequently when clicking play.

    HOW TO PREVENT THIS ISSUE:
    So my advice to prevent this. Keep your physical VR Rig completely decoupled from any deep hierarchies and ensure it is enabled at the point a VR SDK is loaded. Basically work and solve problems while always keeping the physical rig and camera out of it, the issue seemed so sporadic because over time, as hierarchies get more complex and polish gets added, this issue can arise with what seems to be, no real reason, and this can really put a massive roadblock in development.
     
    alexchesser likes this.
  8. jbutka

    jbutka

    Joined:
    Mar 21, 2020
    Posts:
    1
    SOLVED:

    For me, I unchecked the box to "Enable VR Mode Auto-Entry.


    Here's how to o that in Unreal / U4:

    Edit > General > VR Mode and uncheck the box in the General - VR mode menu (found in the General section).

    I restarted the PC and viola.
     
  9. samra2494

    samra2494

    Joined:
    Nov 23, 2015
    Posts:
    19
    cant find Edit > General > VR Mode
     
  10. tacman1123

    tacman1123

    Joined:
    Sep 14, 2020
    Posts:
    61
    I also found that disabling and then re-enabling the Oculus Plugin allowed my scene to play both in the editor's game window and the headset.
     
  11. MikD

    MikD

    Joined:
    Oct 28, 2018
    Posts:
    3
    I have no idea if this post is still being reviewed but I was tearing my hair out for a while about this. What fixed it for me was that I forgot to click on player settings and add plugin support for the PC! It was driving me nuts because I had another project that worked perfectly in play and install. So, to recap what you need to play Unity through link is:
    1) USB C cable(cannot just be an Anker cable, learned that the hard way) - the cable has a blue piece of plastic inside the connector as opposed to black)
    2) Need to enable developer mode in your headset (too many more steps to list in this post, you'll need to look that up yourself)
    3) You need the actual Oculus app downloaded(it is a long download) AND running on your machine
    4) You need to enable beta link in your oculus headset once it's plugged in.
    5) Need Oculus XR Management and install Oculus plugin under BOTH the Android AND PC (if you are debugging on PC obviously) tabs
    6) Need an XR rig in the game itself
     
    AllonXR, wyattroy and tacman1123 like this.
  12. tacman1123

    tacman1123

    Joined:
    Sep 14, 2020
    Posts:
    61
    Nice summary, @MikD

    I'll echo the "Make sure it's the right cable" -- and NOT the charging cable that comes with the Quest!
     
  13. wyattroy

    wyattroy

    Joined:
    Nov 12, 2017
    Posts:
    1
    THANK YOU OMG YOU HERO
     
  14. audiojunkie1974

    audiojunkie1974

    Joined:
    Mar 2, 2021
    Posts:
    1
    you are my here
     
  15. ElegantUniverse

    ElegantUniverse

    Joined:
    Sep 13, 2018
    Posts:
    63
    [Solved]
    for me I didnt assign the SDK and JDK path correctly . you can check this issue . go to edit/Preferences/ExternalTools and check the SDk and Ndk and JDK path.
    [Update]
    we should also enable oculus link mode in quick settings. (in the cornet click on time and wifi icon then click on oculus link then the default enviroment should change, nowif you click on play mode of unity you will see your unity scene in your VR heaset.)
     
    Last edited: Sep 13, 2021
unityunity