Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Question OpenXR does not initialize for SteamVR+Vive in build

Discussion in 'VR' started by nomadic, May 19, 2021.

  1. nomadic

    nomadic

    Joined:
    Mar 4, 2010
    Posts:
    42
    I can run a Vive through SteamVR connected to the editor with OpenXR Plugin 1.2.0 (I have to set the Runtime explicitly to SteamVR). This does not work in a build. Is the editor doing some magic with XR Loaders that I need to implement for a build? Is it currently even possible to build an app for SteamVR using Unity XR or am I wasting my time? Should I stick with Valve's Open VR plugin?

    Unity 2020.3.4f1
    OpenXR Plugin 1.2.0
    XR Plugin Management 4.0.5
     
  2. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    When you say you set the runtime explicitly to Steam VR do you mean in the OpenXR settings UI or on your system? The setting in the OpenXR settings just alters the runtime for when you are in the Unity Editor rather than changing the runtime on your system. I believe there is a way in the SteamVR menus to set the SteamVR OpenXR runtime as active.

    Let me know if your system runtime is set to SteamVr and are still having this issue. Thanks.
     
  3. nomadic

    nomadic

    Joined:
    Mar 4, 2010
    Posts:
    42
    Does this mean that SteamVR end users must configure their developer settings to play apps built with Unity OpenXR Plugin?
     
  4. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    The way OpenXR works on windows is there is a single runtime that is set by default. It may be SteamVR or the oculus runtime or the windows mixed reality runtime, etc. That setting is managed outside of the unity editor / player, usually by the accompanying app for the runtime such as SteamVR, oculus desktop , or windows mixed reality. Generally it should just work for most people since most people dont have multiple headsets but anyone with multiple headsets that use different runtimes may have to force the active runtime switch when switching between devices. I know the OpenXR working group has discussed making it easier on users but I dont think there are formal decisions yet.
     
    nomadic and ReneDC like this.
  5. Threeyes

    Threeyes

    Joined:
    Jun 19, 2014
    Posts:
    73
    Have the same problem here, We use OpenXR only (without 'SteamVR for XR' plugin)
    In Editor it works fine, but after build, it just don't work, and here's the player log:

    Code (CSharp):
    1.  
    2. [Subsystems] Failed to initialize subsystem OpenXR Display [error: 1]
    3. [XR] [40424] [17:47:29.402][Info   ]
    4.  
    5. ==== Start Unity OpenXR Diagnostic Report ====
    6.  
    7.  
    8. [XR] [40424] [17:47:29.402][Info   ] ==== Report Reason: System Shutdown ====
    9.  
    10.  
    11. [XR] [40424] [17:47:29.402][Info   ] ==== OpenXR Support Details ====
    12. [XR] [40424] [17:47:29.402][Info   ] OpenXR Runtime:
    13. [XR] [40424] [17:47:29.402][Info   ]     Microsoft, which is a Unity supported partner
    14. [XR] [40424] [17:47:29.402][Info   ] Unity OpenXR Features:
    15. [XR] [40424] [17:47:29.402][Info   ]     HTCViveControllerProfile Standalone, RuntimeDebuggerOpenXRFeature Standalone: Unity
    16. [XR] [40424] [17:47:29.402][Info   ] Unity Support:
    17. [XR] [40424] [17:47:29.402][Info   ]     Unity supports the runtime and Unity OpenXR Features above. When requesting assistance, please copy the OpenXR section from ==== Start Unity OpenXR Diagnostic Report ==== to ==== End Unity OpenXR Diagnostic Report ==== to the bug or forum post.
     
  6. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Which headset are you using ? The original poster was using a vive but you are using the Microsoft openxr runtime so just want to make sure.

     
  7. Threeyes

    Threeyes

    Joined:
    Jun 19, 2014
    Posts:
    73
    Thanks for your replay, I have this problem for a week, just when I thought it might be something wrong with openxr, then I see your post…
    It turns out I have install [SteamVr] and [windows mixed reality runtime] at the same computer, even thought the HTV Vive device is stay plugin-in, the OpenXR still treat [windows mixed reality] as the default runtime.
    I suppose that we can have an extra option: Run base on current plugin-in device, or else more developers may complain about simular situation like this, thanks:)

    Is there any code we can manual set the runtime? I have try copy some files from OpenXRRuntimeSelector.cs but no luck:
    Code (CSharp):
    1.    
    2.     class SteamVRDetector : RuntimeDetector
    3.     {
    4.         public override string name => "SteamVR";
    5.         public override string jsonPath => @"C:\Program Files (x86)\Steam\steamapps\common\SteamVR\steamxr_win64.json";
    6.     }
    7. private static void UpdateVRReference()
    8.     {
    9. #if UNITY_STANDALONE
    10.         string envValue = Environment.GetEnvironmentVariable(k_SelectedRuntimeEnvKey);
    11.         if (envValue != steamVRDetectorInst.jsonPath)
    12.         {
    13.             steamVRDetectorInst.PrepareRuntime();
    14.             Environment.SetEnvironmentVariable(k_SelectedRuntimeEnvKey, steamVRDetectorInst.jsonPath);
    15.  
    16. #if UNITY_EDITOR
    17.             EditorTool.RepaintAllViews();
    18. #endif
    19.         }
    20.         steamVRDetectorInst.Activate();//Force Set Environment
    21. #endif
    22.     }

    [Lastest Update]:
    Problem Solve! For anyone who faces the same problem, you may try this:
    1. Open "SteamVR Setting" Panel, and show advance setting
    2. Click "Developer" Module, and set current OpenXR runtime as SteamVR
     
    Last edited: May 17, 2022
  8. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    71
    This is a very critical problem for developers. @the_real_apoxol

    I want to publish a VR app at the viveport made with Unity 2020.3.15 + openXR. Today it was rejected. I tested it on three different Headsets (wmr, oculus, htc) and everything worked fine. In the rejection mail they said, that "there's no image in the VR Headset." They also send there player log:

    At the beginning of the player.log I see the lines:

    [XR] [17744] [17:39:44.530][Info ] ==== OpenXR Support Details ====
    [XR] [17744] [17:39:44.530][Info ] OpenXR Runtime:
    [XR] [17744] [17:39:44.530][Info ] UNKNOWN COMPANY, which is not a Unity supported partner

    We all know, that the third line should be something like:

    Valve / Microsoft / Oculus

    So it seems, that the system they use has not an OpenXR Runtime set. But because it's a market where user just download apps and want to play... it's not an option option that user should make dev settings.

    So I really ask for a dropdown like "Play Mode OpenXR Runtime" -> "Build OpenXR Runtime"
     
    Juruhn likes this.
  9. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    71
    Or maybe someone can call their friends at Steam / viveport and tell them to check and set the openXR Runtime to Steam if necessary ;)
     
  10. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Unfortunately this is out of our control for now. However the new OpenXR 1.0.18 spec was just released which now has support for runtimes to publish their existence in the registry which allows for a runtime selector to be created. I dont know how or if this will be surfaced within unity yet, but it does open the door for a discussion on this topic that was not available previously. For example it would be possible to detect that there are no runtimes installed, or runtimes installed but none active. What still will not be possible however is if a runtime that does not match your headset is active. For example the Windows Mixed reality runtime is active but you are trying to use an oculus. This could perhaps be handled by a popup that detects the failure to initialize, recognizes other runtimes installed, and suggests an alternative. I will bring this topic up more with the team today.
     
  11. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    71
    Thank you. I also posted this problem in the viveport forum and hope that this is solved at the one or other end.

    Still wondering, why there are so many news and support for a new technique (openXR), but at the end app don't reaches the user, because there are fundamental problems starting it.
     
  12. FreekM

    FreekM

    Joined:
    Nov 10, 2016
    Posts:
    1
    We are having the same problem, also posted this question in the Unity slack. For us, the only solution now seems to be to build with SteamVR instead of OpenXR I guess, as we are only targeting Viveport for this specific project.
     
    noemis likes this.
  13. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    The active runtime is just a JSON entry in the registry that the OpenXR loader uses. You could write your own logic to check the registry and make sure steam is set and if not tell the user to set steam active (or set it active yourself if you want to change the registry).
     
  14. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    71
    So this seem like a possible workaround. But I don't know, if it's a good idea if my app should change the users runtime. And if so, I could create a button, so that the user has to confirm it but still, I have no idea, how to invoke a change of a registry via c#.

    I think we are talking about this entry:

    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenXR\1\ActiveRuntime

    Hope someone could help with this. I found no useful infos about this.
     
  15. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    71
    After several submits, which always have been rejected because on some headsets there were problems (e.g. no image in VR, controller not appearing, crash on vive pro at start, not working with ViveOpenXR,...) I'm not very exited about OpenXR anymore... this standard seem to be so complex, that it not behaves consistent.

    As @FreekM I switched to OpenVR and submited another version. Let's see... Luckily I was on 2020.3.17 that it was very easy to add the XR Plugin.
     
    Reahreic likes this.
  16. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    71
    ...and it's released! It's sad, that replacing the OpenXR plugin with openVR solved all compatibility issues. But that's it.
     
    Reahreic likes this.
  17. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Failed submits to Steam? I do not know what the state of the Vive Runtime is at this point, were you having problems with other devices failing?
     
  18. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    499
    I had the same issues and in SteamVR/Advanced options one can simply click to make SteamVR the default OpenXR runtime and this solved it for me (the same exists in the Oculus app under the Beta tab). It's really up to the user what headset he wants to use and for the typical one-headset user it should not be an issue. So far OpenXR is awesome. One build. Works out of the box without any adjustments so far on Quest, Rift and Vive.
     
  19. Tunkali

    Tunkali

    Joined:
    Feb 5, 2013
    Posts:
    54
    We have a similar problem on our end. Our build was rejected because openxr crashes when the user has a wmr headset together with the steamvr runtime (steam seems to be expecting that wmr should work with steam vr as default openxr runtime). I have to say that some other games I tested are not crashing this way. The only workaround for us is using the beta of wmr for steam runtime. There seems to happen a miscommunication in the chain Unity -> OpenXR -> SteamVR -> WMR. This is not what I would expect from an universal standardization. It is a pain for developers to identify what or who is responsible for the problems here.
     
  20. valeriounity

    valeriounity

    Joined:
    Mar 23, 2020
    Posts:
    5
    I'm spending days to understand why my app runs as expected in the editor while in build my whole scene rotates with the VRcamera and no input are passing through...

    I set OpenXR as runtime default in my steamVR.
    I had to wrap all Valve code that I used in my scripts in #if !UNITY_ANDROID directives otherwise NO BUILD AT ALL!
    I THINK I did all the required settings to make it communicate with my oculus quest... but still I think wrong...
     
  21. InMindStudios

    InMindStudios

    Joined:
    Dec 5, 2020
    Posts:
    9
    Hey guys. I have a huge problem and it seems to be the same you are struggling with. I finally had time to finish my VR game. ALways buildt with SteamVR and a Vive. Never any problems in Unity. Now all is updated and I cannot get the bloody thing to open in Steam Vr at all when I press the play button to test my build. Can somebody please help me?
     
  22. Eco-Editor

    Eco-Editor

    Joined:
    Jun 29, 2016
    Posts:
    66
    Wow @Threeyes , thanks so much! This solved my issue :)
     
    Threeyes likes this.
  23. Reahreic

    Reahreic

    Joined:
    Mar 23, 2011
    Posts:
    282
    Can you please elaborate on this, I'm trying to update our app from the old 2019.2 VR solution to the new OpenXR solution and it's a S***show by comparison. OpenXR just will not initialize regardless of the package manager selections or OpenXR runtimes selected.

    Do I really need to install multiple plugins for each headset? I thought OpenXR was supposed to move us away from that by making it so I just need to select the OpenXR checkbox and call it a day.

    Update - Success
    I started a 100% fresh project re-tracing all of my steps and OpenXR just worked, for both SteamVR and WMR. Comparing the packages of that project to my current project identified a few minor differences.

    Once I nuked the XRInteractionToolkit package (https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@1.0/manual/index.html) OpenXR started initializing XR again. As an added bonus the Convert main camera to XRRig option came back too.

    Stay away from the XRInteractionToolkit package! It's an abomination and has cost me approx. 16 hours of my life that I'll never get back troubleshooting the upgrade.

    Side Note: There appears to be an incompatibility with the new OpenXR render pipeline and graphics.Blit. If you get a stuck HMD image, or if one eye is a solid color (white for me) and the other is frozen or black. Check your post processing effects by disabling them.
     
    Last edited: Jun 30, 2022
  24. Knipsch

    Knipsch

    Joined:
    Sep 12, 2018
    Posts:
    7
    I'm having the same problem; the OpenXR build doesn't work with SteamVR. Removing the XRInteractionToolkit package didn't fix the problem. I'll post here if I find a solution.
     
  25. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    382
    @the_real_apoxol
    I like how OpenXR makes it easier working with different frameworks.
    However, one major drawback is that if I am building an app with OpenXR for steam, I usually don't care which runtime would be used (users can use any headset with steam vr), but if OpenXR didn't load up steam VR for a steam vr targeted build, there can be major issues.

    One major issues I faced:
    I noticed that pressing the system button wouldn't open the steam VR system screen and in app purchase screens won't appear for steam VR uploaded builds that uses OpenXR if the end user is using an Oculus device for example. That's not the case if the app is not using OpenXR, the user would see the in app purchase screen and it won't matter even if he uses Oculus device.
     
  26. SB12unitypro1

    SB12unitypro1

    Joined:
    Sep 27, 2018
    Posts:
    3
    Hi, we also have the issue that even with "Current openXR Runtime" set to Steam VR in Steam VR settings, our Unity App is not launched with the connected Vive, its only running on desktop.

    unity Version 2021.3.22