Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity Play mode not rendering in VR headset.

Discussion in 'VR' 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.
     
  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:
    21
    cant find Edit > General > VR Mode
     
  10. tacman1123

    tacman1123

    Joined:
    Sep 14, 2020
    Posts:
    77
    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
     
    chantey, cemkilinc, AllonVR and 2 others like this.
  12. tacman1123

    tacman1123

    Joined:
    Sep 14, 2020
    Posts:
    77
    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:
    4
    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:
    78
    [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
  16. aditya3043

    aditya3043

    Joined:
    Jun 10, 2017
    Posts:
    1
    [Solved]
    For me I didn't install the XR management package. After installing it worked magically.
     
  17. kyxap

    kyxap

    Joined:
    Aug 20, 2021
    Posts:
    8
    so the play does not work for me ether but if you build and play it's displaying scene in the vr. i'm using usb-c cable from mac charger :) is this still the cable issue?
     
  18. SoerenEkelund

    SoerenEkelund

    Joined:
    Mar 3, 2022
    Posts:
    6
    I have sort-of this problem with my own apps and the DistanceGrab sample scene; I can build to the Oculus Quest 2 and the scene shows there, but as a flat screen picture rather than immersive VR - controllers work, but not inside the scene. See screen capture below...

    I have tried all the advice given above, and quite a bit more from elsewhere, but with no improvement. Any ideas?

    com.oculus.shellenv-20220612-125343.jpg
     
  19. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    782
    Do you mean it doesn't render in stereo? Maybe the scene is just a flat 360 panorama?
     
  20. SoerenEkelund

    SoerenEkelund

    Joined:
    Mar 3, 2022
    Posts:
    6
    Thank you for your interest. No, it is not a 360 deg flat panorama. What I mean is that the DistanceGrab does not render with the user at the center in 3D environment - as opposed to my screenshot above, the DistanceGrab sample scene (DistanceGrab Sample Scene | Oculus Developers) is supposed to look like this with the user in the middle, using hands to grab objects:

    2022-06-13 (6).png
     
  21. SoerenEkelund

    SoerenEkelund

    Joined:
    Mar 3, 2022
    Posts:
    6
    Let me be more specific:

    I am developing in Unity for Quest 2. Recent apps I test-deploy have only shown up as flat un-interactive scenes, see three attached examples with and without OVR Transition Scene, with the black screen with a 0 being the VrBoardGame and the two others being DistantGrab.

    Both examples are of the unmodified DistanceGrab or VrboardGame sample scenes from the Oculus Integration Package (https://developer.oculus.com/documentation/unity/unity-import/#3-import-the-unity-package).

    Launching from Unity (2021.3.4f1 - 3D URP, OpenXR SDK 1.4.2) or Oculus Developer Hub (using .apk file generated by Unity) makes no difference - see screenshot below of ODH setup and device identification.

    2022-06-13 (8).png com.oculus.shellenv-20220612-125343.jpg com.oculus.shellenv-20220613-174955.jpg com.oculus.shellenv-20220613-175951.jpg
     
    Last edited: Jun 13, 2022
  22. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    782
    I'm still not sure what the problem is. Have you by the way followed any recent tutorial for setting up the basic stuff for the vr environment? This one for example:

     
  23. SoerenEkelund

    SoerenEkelund

    Joined:
    Mar 3, 2022
    Posts:
    6
    Thank you, but it is an old video not relating to the newest Unity LTS version - and things such as the XR Interaction Toolkit no longer works for the newest version, having been replaced with the Oculus Integration Package with the following guide (which I have followed, from start to end): Import Oculus Integration Package | Oculus Developers

    I suggest this up-to-date video instead, as a companion to the official guide above:
    - note that this is already somewhat outdated, with the official guide suggesting Minimum API Level = Android 10 (API level 29) as opposed to Android 6 (API Level 23) as suggested in the video.
     
    arfish likes this.
  24. SoerenEkelund

    SoerenEkelund

    Joined:
    Mar 3, 2022
    Posts:
    6
    1) Oculus Support now came back to me (within 24 hours, well done!) with the suggestion that Oculus was not enabled under XR Management (Project Settings -> XR Plug-in Management -> Oculus), since this is not directly required by the guide.

    This now resulted in full 3D immersion for all developer apps (solving my initial issue with lacking 3D immersion).

    BUT this now makes the apps behaving oddly, with DistanceGrab being buggy and unresponsive to controller clicks, as well as the lines from controllers being blurry, and with VrBoardGames completely lacking controllers and simply following the headset (as can be seen in the screenshots below).

    I have below also added screenshots of a quick test-app with just solids - to confirm that it is not the sample scenes that are buggy or damaged by default - and this sample scene also looks obviously weird with regards to the shadows.


    2) While going through the Oculus Unity guide I saw the following suggested under Define Quality Settings (https://developer.oculus.com/documentation/unity/unity-conf-settings/#set-quality-options):
    "On the menu, go to Edit > Project Settings > Quality.
    In Pixel Light Count, set the maximum number of pixel light count to one."

    This is not possible in my Unity version (2021.3.4f1, 3D URP), see attached screenshot below for my options.

    Anything in this that might cause the problems, and should I rather use another Unity version?

    com.Me.OculusTest3-20220614-120542.jpg com.OculusTest.X01-20220614-100202.jpg com.OculusTest.X01-20220614-101053.jpg com.OculusTest.X01-20220614-101057.jpg
    2022-06-14 (6).png
     
  25. SoerenEkelund

    SoerenEkelund

    Joined:
    Mar 3, 2022
    Posts:
    6
    OBS! Hi all, thank you for the help :)

    In the end I decided to ignore the official Oculus guides completely and used this video instead - and this solved all my problems with my own apps: How to Make VR Games in 2022 - Updated Unity VR Tutorial - YouTube

    NB: The sample apps VrBoardGame and DistanceGrab still doesn't work for me, but never mind since I just used them to easily show my problem.
     
  26. Bethsheba_Ashe

    Bethsheba_Ashe

    Joined:
    Feb 11, 2022
    Posts:
    15
    pause.JPG
    I was tearing my hair out, and then realized that the pause button was pressed. I unchecked it, and voila! I could play again. Thought I should share because I gather this catches a lot of people out.
     
  27. mown90

    mown90

    Joined:
    Nov 30, 2018
    Posts:
    9
    If anyone still having this problem, what worked for me is to initialize Oculus in the Plug-in Providers section for the PC platform not only for the Android, when I checked "Oculus" option it worked fine
     

    Attached Files:

  28. ansu2101

    ansu2101

    Joined:
    Sep 9, 2021
    Posts:
    1
    THANK YOU!
    This was my issue, tried everything and now it works!
     
  29. bansheesoft

    bansheesoft

    Joined:
    Oct 3, 2014
    Posts:
    62
    Well I had the issue also and I did not have time to read all the posts above. For me uninstalling OpenXR, OculusXR,OpenXR,XR CORE Utilties,XR interaction toolkit, XR legacy input helpers, XR plugin Management. Then reinstalling and using the setting I saw in the sample VR project startup supplied from Unity foxed it for me.

    Thank goodness.