ValveSoftware / steamvr_unity_plugin

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/
BSD 3-Clause "New" or "Revised" License
1.04k stars 259 forks source link

VRApp works in the Editor but not in built using Linux #1110

Closed Hydran00 closed 4 months ago

Hydran00 commented 8 months ago

Hi, I am currently trying to build a VR application for Linux using this plugin. I loaded the Interactions_Example scene and it runs perfectly fine in the Editor: head movements are tracked perfectly together with controllers. The problem is that I cannot see my controllers and also buttons do not work in the built Linux application. The only thing that works is the head movement tracking, so I am able to look around but I cannot do anything else. Setup:

Step to reproduce:

  1. Launch ALVR and connect your headset using SteamVR
  2. Open a new 3D Core Project in Unity
  3. Import the steam_vr custom package following #1107
  4. Toggle Initialize XR on Startup and OpenVR Loader in Edit -> Project Settings -> XR Plugin Management
  5. Set Stereo Rendering Module to Multipass and Mirror View Mode to Open VR in Edit -> Project Settings -> OpenVR
  6. Switch Graphics API to Vulkan for Linux in Edit -> Project Settings -> Player -> Rendering
  7. Generate SteamVR Inputs through Window -> SteamVR Input -> Save and generate
  8. Press play -> it works correctly
  9. Build app with File -> Build Settings -> Add Open Scenes then select Linux as Target Platform
  10. Launch compiled AppImage -> head movement is tracked but no controllers appear

Update:

I managed to isolate the problem but still no solution: if I run the app built in debug mode and open the generated log file I find:

...
    Editor App Name : 
[XR]    Editor App Key : 
[XR]    Action Manifest Path : /home/nardi/Build/VRTest2_Data/StreamingAssets/SteamVR/actions.json
[XR]    Stereo Rendering Mode : Multi Pass
[XR]    Initialization Type : Scene
[XR]    Mirror View Mode : OpenVR View
[XR] [OpenVR] [path] /home/nardi/VRTest2
[XR] [OpenVR] [Error] Action manifest file does not exist at path (/home/nardi/VRTest2/Assets//home/nardi/Build/VRTest2_Data/StreamingAssets/SteamVR/actions.jsonore)
[XR] [OpenVR] startupInfo: { 
    "action_manifest_path": "/home/nardi/VRTest2/Assets//home/nardi/Build/VRTest2_Data/StreamingAssets/SteamVR/actions.jsonore"
}
...

And I noticed the incorrect path that seems to be a concatenation of two paths. It should be only /home/nardi/Build/VRTest2_Data/StreamingAssets/SteamVR/actions.jsonore. But I did not find a way to change this.

This seems to be the main issue because after some not-interesting debug lines there is a list of failures that probably are the reason why controllers are not spawning in the scene:

<b>[SteamVR]</b> GetInputSourceHandle (/unrestricted) error: NoData
UnityEngine.StackTraceUtility:ExtractStackTrace () (at /home/bokken/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogError (object)
Valve.VR.SteamVR_Input_Source:Initialize () (at /home/nardi/VRTest2/Assets/SteamVR/Input/SteamVR_Input_Source.cs:70)
Valve.VR.SteamVR_Input:Initialize (bool) (at /home/nardi/VRTest2/Assets/SteamVR/Input/SteamVR_Input.cs:163)
Valve.VR.SteamVR:CreateInstance () (at /home/nardi/VRTest2/Assets/SteamVR/Scripts/SteamVR.cs:226)
Valve.VR.SteamVR:Initialize (bool) (at /home/nardi/VRTest2/Assets/SteamVR/Scripts/SteamVR.cs:122)
Valve.VR.SteamVR_Behaviour:InitializeSteamVR (bool) (at /home/nardi/VRTest2/Assets/SteamVR/Scripts/SteamVR_Behaviour.cs:119)
Valve.VR.SteamVR_Behaviour:Awake () (at /home/nardi/VRTest2/Assets/SteamVR/Scripts/SteamVR_Behaviour.cs:100)
...
other errors
Hydran00 commented 8 months ago

After several tests I finally managed to make it work.

The issue seems to be related to the generation of SteamVR inputs (step 7 of previous comment).

WORKAROUND:

I generated the inputs before opening the Interactions_Example and pressing Play. If you directly press Play and then you accept the prompt for generating inputs you may face my issue.

My thought is that maybe there is a bug in the way paths to the actions.json are generated.

zite commented 4 months ago

Hi, thanks for the report. Do you mind giving this a try with the latest beta? https://github.com/ValveSoftware/steamvr_unity_plugin/releases

Hydran00 commented 4 months ago

I tested the last beta (v2.8.3) and indeed I faced no issue, furthermore the issue https://github.com/ValveSoftware/steamvr_unity_plugin/issues/1107 seems to be solved.

For anyone working in linux that is facing some problems, you can try following my steps:

My setup:

Steps:

  1. Launch ALVR and connect your headset using SteamVR
  2. Open a new 3D Core Project in Unity
  3. Import the steam_vr custom package v2.8.3
  4. Toggle Initialize XR on Startup and OpenVR Loader in Edit -> Project Settings -> XR Plugin Management
  5. Set Stereo Rendering Module to Multipass and Mirror View Mode to Open VR in Edit -> Project Settings -> OpenVR
  6. Switch Graphics API to Vulkan for Linux in Edit -> Project Settings -> Player -> Rendering
  7. Generate SteamVR Inputs through Window -> SteamVR Input -> Save and generate
  8. Press play and check if the scene enter VR mode
  9. Build app with File -> Build Settings -> Add Open Scenes then select Linux as Target Platform
  10. Launch compiled AppImage
SinanAkkoyun commented 1 month ago

Hey @Hydran00 , how did you manage to even let it run at all? After importing SteamVR (from assets store), it warns me that recommended platform is windows (but I leave it at linux), when I hit play in the editor it crashes

Hydran00 commented 1 month ago

Hi @SinanAkkoyun. I have the same warning obviously, but I ignored it. Are you able to enter play mode without connecting the headset? Did you follow each of my steps in the previous comment? I need more details to be able to help you! 😀

SinanAkkoyun commented 1 month ago

Hi @Hydran00 , acutally you already helped me out, I just had a problem with switching to Vulkan but now it works 😊 Thank you!