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

Unity editor crashes when playing with the OpenVR plugin #704

Closed QThund closed 4 years ago

QThund commented 4 years ago

Hi Valve developers,

I've downloaded the package mentioned here https://steamcommunity.com/app/250820/discussions/7/2268069450205612646/

I've also added the package in the Package Manager via GIt URL. I've configured the XR Plugin Management settings to activate the OpenVR plugin. When I press the Play button of the editor, it crashes. I've checked the editor log file, and there is nothing helpful there, every time there is a null reference in a different raddom place of the program that has nothing to do with this. If I uncheck the OpenVR Loader in the settings, then the program runs without VR, obviously. Using Unity 2019.3.12. My Oculus Rift works with the Oculus plugin with no issues. I have both options checked in the settings.

Is there any information you would find useful that I could provide?

Thanks in advance.

0lento commented 4 years ago

I'm seeing editor crashes on some projects I've tried this new XR plugin with but I don't have precise repro case for it. What does crash 100% of the time on built player though is the following:

As additional note: if you build using 32-bit x86 windows target, OpenVR straight up fails to initialize on it (doesn't crash but VR doesn't work either).

QThund commented 4 years ago

I forgot to say that I'm using URP. On Windows 10. Just in case it gives any clue.

0lento commented 4 years ago

For what it's worth, for the editor crash I'm seeing on one project, I get this on editor.log:

UnityEngine.XR.Management.XRGeneralSettings:AttemptStartXRSDKOnBeforeSplashScreen () (at Library/PackageCache/com.unity.xr.management@3.2.10/Runtime/XRGeneralSettings.cs:158)

(Filename: Library/PackageCache/com.unity.xr.management@3.2.10/Runtime/XRGeneralSettings.cs Line: 158)

Stacktrace:

Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

Received signal SIGSEGV Stack trace: 0x000001fcf7ecb849 (XRSDKOpenVR) XRSDKPreInit 0x000001fcf7ec9be5 (XRSDKOpenVR) XRSDKPreInit 0x00007ff7cb4a9eae (Unity) XRInputSubsystem::Update 0x00007ff7cb4cb1c1 (Unity) XRInputSubsystemManager::Update 0x00007ff7c9bf4909 (Unity) CallbackArray::Invoke 0x00007ff7cb4518fc (Unity) XREngineCallbacks::XREngineCallbacks::2::EarlyUpdateXRUpdateRegistrator::Forward 0x00007ff7ca8f2199 (Unity) ExecutePlayerLoop 0x00007ff7ca8f2270 (Unity) ExecutePlayerLoop 0x00007ff7ca8f7c7c (Unity) PlayerLoop 0x00007ff7cbb5520e (Unity) PlayerLoopController::UpdateScene 0x00007ff7cbb3e39e (Unity) PlayerLoopController::EnterPlayMode 0x00007ff7cbb51178 (Unity) PlayerLoopController::SetIsPlaying 0x00007ff7cbb546a6 (Unity) Application::TickTimer 0x00007ff7cc322894 (Unity) MainMessageLoop 0x00007ff7cc326201 (Unity) WinMain 0x00007ff7cde5d496 (Unity) __scrt_common_main_seh 0x00007ffc8e977bd4 (KERNEL32) BaseThreadInitThunk 0x00007ffc9086ce51 (ntdll) RtlUserThreadStart

DrummerB commented 4 years ago

I have the same issue. I think it's related to scriptable rendering pipelines. I can reproduce the crash like this:

  1. Create a new project from the HDRP template using Unity 2020.1.0b7
  2. Add XR Plugin Management package (version 3.2.10)
  3. Add OpenVR XR Plugin package via git URL (version 1.0.0 preview 1)
  4. In the sample scene, add a TrackedPoseDriver to the Main Camera
  5. Hit Play (seems to crash 1 out of 3 times)
[XR] [Mirror] Mirror overlay found [0]
[XR] [Mirror] Fall back to left eye texture
[XR] [Mirror] Reverting from fallback mode...
[XR] [Mirror] Mirror overlay found [0]
[XR] [Mirror] Fall back to left eye texture
[XR] [Mirror] Reverting from fallback mode...
[XR] [Mirror] Mirror overlay found [0]
[XR] [Mirror] Fall back to left eye texture
[XR] [Mirror] Reverting from fallback mode...
[XR] [Mirror] Mirror overlay found [0]
[XR] [Mirror] Fall back to left eye texture
[XR] Device disconnected (stopping provider). Handle: 545199504. DeviceID: 0
[XR] Device disconnected (stopping provider). Handle: 545199504. DeviceID: 1
[XR] Device disconnected (stopping provider). Handle: 545199504. DeviceID: 2
[XR] XR OpenVR Display Stop
[XR] XR OpenVR Display Shutdown
XRTextureManager::RequestDestroyTexture
XRTextureManager::RequestDestroyTexture
XRTextureManager::RequestDestroyTexture
XRTextureManager::RequestDestroyTexture
[XR] [OpenVR] Shutdown
XRTextureManager::RequestDestroyTexture
XRTextureManager::RequestDestroyTexture
XRTextureManager::RequestDestroyTexture
XRTextureManager::RequestDestroyTexture
Unloading 136 Unused Serialized files (Serialized files now loaded: 0)
Loaded scene 'Temp/__Backupscenes/0.backup'
    Deserialize:            3.515 ms
    Integration:            22.684 ms
    Integration of assets:  0.004 ms
    Thread Wait Time:       15.608 ms
    Total Operation Time:   41.812 ms
System memory in use before: 182.4 MB.
System memory in use after: 181.8 MB.

Unloading 177 unused Assets to reduce memory usage. Loaded Objects now: 5008.
Total: 38.904500 ms (FindLiveObjects: 0.738100 ms CreateObjectMapping: 0.122500 ms MarkObjects: 37.762200 ms  DeleteObjects: 0.280900 ms)

Refresh completed in 0.069461 seconds.
RefreshInfo: RefreshV2(AllowForceSynchronousImport) scanfilter: 
RefreshProfiler: Total: 67.659ms
    InvokeBeforeRefreshCallbacks: 0.365ms
    ApplyChangesToAssetFolders: 0.067ms
    WriteModifiedImportersToTextMetaFiles: 0.000ms
    CleanLegacyArtifacts: 0.000ms
    Scan: 1.514ms
    OnSourceAssetsModified: 0.000ms
    UnregisterDeletedAssets: 0.000ms
    InitializeImportedAssetsSnapshot: 6.784ms
    GetAllGuidsForCategorization: 0.252ms
    CategorizeAssets: 44.382ms
    ImportAndPostprocessOutOfDateAssets: 6.749ms (3.461ms without children)
        ImportManagerImport: 0.000ms (0.000ms without children)
            ImportInProcess: 0.000ms
            ImportOutOfProcess: 0.000ms
            UpdateCategorizedAssets: 0.000ms
            RemoteAssetCacheUploadArtifacts: 0.000ms (0.000ms without children)
                RemoteAssetCacheUploadMetadata: 0.000ms
            RemoteAssetCacheGetArtifact: 0.000ms (0.000ms without children)
                RemoteAssetCacheFetchMetadata: 0.000ms
                RemoteAssetCacheMatchMetadataResults: 0.000ms
                RemoteAssetCacheDownloadFile: 0.000ms
        CompileScripts: 0.000ms
        PostProcessAllAssets: 0.000ms
        ReloadImportedAssets: 0.000ms
        VerifyAssetsAreUpToDateAndCorrect: 0.000ms
        EnsureUptoDateAssetsAreRegisteredWithGuidPM: 0.499ms
        InitializingProgressBar: 0.000ms
        PostProcessAllAssetNotificationsAddChangedAssets: 0.187ms
        OnDemandSchedulerStart: 0.229ms
        RestoreLoadedAssetsState: 2.373ms
    InvokeProjectHasChanged: 0.000ms
    UpdateImportedAssetsSnapshot: -0.001ms
    ReloadSourceAssets: 1.148ms
    UnloadImportedAssets: 0.237ms
    Hotreload: 0.442ms
    FixTempGuids: 0.008ms
    VerifyGuidPMRegistrations: 0.000ms
    GatherAllCurrentPrimaryArtifactRevisions: 0.386ms
    UnloadStreamsBegin: 0.362ms
    LoadedImportedAssetsSnapshotReleaseGCHandles: 1.366ms
    GetLoadedSourceAssetsSnapshot: 3.819ms
    PersistCurrentRevisions: 0.143ms
    UnloadStreamsEnd: 0.049ms
    Untracked: -0.415ms
Reloading assemblies for play mode.
Begin MonoManager ReloadAssembly
JCBuck commented 4 years ago

I'm seeing editor crashes on some projects I've tried this new XR plugin with but I don't have precise repro case for it. What does crash 100% of the time on built player though is the following:

* Make a new project with HDRP Template from Unity Hub (doesn't matter if you use 2019.3 or even 2020.2 alpha, same end result)

* install latest XR management package using Package Manager

* add "https://github.com/ValveSoftware/steamvr_unity_plugin.git#UnityXRPlugin" as git url on Package Manager

* go to player settings -> xr management and enable OpenVR loader

* go to build settings and use Windows and x86_64 for your target

* build using otherwise default settings (so mono as scripting backend)

* launch the built player and observe it crash immediately after Unity Splash

As additional note: if you build using 32-bit x86 windows target, OpenVR straight up fails to initialize on it (doesn't crash but VR doesn't work either).

I too am able to reproduce this crash using 2019.3.12f1, and using URP instead of HDRP template when using oculus rift on steamvr

mikson60 commented 4 years ago

Hi,

I am having the same issue. Here is a link to the unity editor log and the steamvr system report: link

I am using Unity 2019.3.3f1 and tried using the new Open XR plugin with legacy steam vr input. I also have Oculus XR Plugin installed. I am also using the old, standard/built-in render pipeline. No URP or HDRP. I am running the application in Linear Color space. I also noticed that a known issue in wiki is that "OpenVR Mirror View Mode (default) can cause black screens in the game view". I tried setting it to None, but no difference in the Editor.

Whenever I try to play in editor, it crashes. It seems that the unity process does get connected to the steam vr application, however as soon as the game becomes playable (it does render a frame or more) it crashes. It also does not matter if there is a XR rig or even a camera in a scene or no. It still crashes.

When I create a Windows build and execute it, the application just has a black screen on my computer monitor and nothing happens, no matter how long I wait. It seems the SteamVR does not even try to start the application and it still stays in Steam Home. Though the FPS in Steam Home (while looking through the Vive headset) is dropped significantly while the malfunctioning executable is running.

I hope this gets fixed asap, otherwise without having the ability to test in editor nor the build, this plugin is simply unusable.

1runeberg commented 4 years ago

hi... we have a candidate fix for this and should come up soon.

1runeberg commented 4 years ago

Hi,

I am having the same issue. Here is a link to the unity editor log and the steamvr system report: link

I am using Unity 2019.3.3f1 and tried using the new Open XR plugin with legacy steam vr input. I also have Oculus XR Plugin installed. I am also using the old, standard/built-in render pipeline. No URP or HDRP. I am running the application in Linear Color space. I also noticed that a known issue in wiki is that "OpenVR Mirror View Mode (default) can cause black screens in the game view". I tried setting it to None, but no difference in the Editor.

Whenever I try to play in editor, it crashes. It seems that the unity process does get connected to the steam vr application, however as soon as the game becomes playable (it does render a frame or more) it crashes. It also does not matter if there is a XR rig or even a camera in a scene or no. It still crashes.

When I create a Windows build and execute it, the application just has a black screen on my computer monitor and nothing happens, no matter how long I wait. It seems the SteamVR does not even try to start the application and it still stays in Steam Home. Though the FPS in Steam Home (while looking through the Vive headset) is dropped significantly while the malfunctioning executable is running.

I hope this gets fixed asap, otherwise without having the ability to test in editor nor the build, this plugin is simply unusable.

Hi @mikson60 - setting it to None should stop any rendering in the Editor, are you still getting a preview even with this setting?

mikson60 commented 4 years ago

Hi, I am having the same issue. Here is a link to the unity editor log and the steamvr system report: link I am using Unity 2019.3.3f1 and tried using the new Open XR plugin with legacy steam vr input. I also have Oculus XR Plugin installed. I am also using the old, standard/built-in render pipeline. No URP or HDRP. I am running the application in Linear Color space. I also noticed that a known issue in wiki is that "OpenVR Mirror View Mode (default) can cause black screens in the game view". I tried setting it to None, but no difference in the Editor. Whenever I try to play in editor, it crashes. It seems that the unity process does get connected to the steam vr application, however as soon as the game becomes playable (it does render a frame or more) it crashes. It also does not matter if there is a XR rig or even a camera in a scene or no. It still crashes. When I create a Windows build and execute it, the application just has a black screen on my computer monitor and nothing happens, no matter how long I wait. It seems the SteamVR does not even try to start the application and it still stays in Steam Home. Though the FPS in Steam Home (while looking through the Vive headset) is dropped significantly while the malfunctioning executable is running. I hope this gets fixed asap, otherwise without having the ability to test in editor nor the build, this plugin is simply unusable.

Hi @mikson60 - setting it to None should stop any rendering in the Editor, are you still getting a preview even with this setting?

Not sure if I get the preview. It crashes anyways. It crashes even when the scene is empty and I hit play. I can check tomorrow if the first few frames are rendered before the crash.

1runeberg commented 4 years ago

Hi, I am having the same issue. Here is a link to the unity editor log and the steamvr system report: link I am using Unity 2019.3.3f1 and tried using the new Open XR plugin with legacy steam vr input. I also have Oculus XR Plugin installed. I am also using the old, standard/built-in render pipeline. No URP or HDRP. I am running the application in Linear Color space. I also noticed that a known issue in wiki is that "OpenVR Mirror View Mode (default) can cause black screens in the game view". I tried setting it to None, but no difference in the Editor. Whenever I try to play in editor, it crashes. It seems that the unity process does get connected to the steam vr application, however as soon as the game becomes playable (it does render a frame or more) it crashes. It also does not matter if there is a XR rig or even a camera in a scene or no. It still crashes. When I create a Windows build and execute it, the application just has a black screen on my computer monitor and nothing happens, no matter how long I wait. It seems the SteamVR does not even try to start the application and it still stays in Steam Home. Though the FPS in Steam Home (while looking through the Vive headset) is dropped significantly while the malfunctioning executable is running. I hope this gets fixed asap, otherwise without having the ability to test in editor nor the build, this plugin is simply unusable.

Hi @mikson60 - setting it to None should stop any rendering in the Editor, are you still getting a preview even with this setting?

Not sure if I get the preview. It crashes anyways. It crashes even when the scene is empty and I hit play. I can check tomorrow if the first few frames are rendered before the crash.

hmm.. this could be something different/unrelated. ill have at a look at your logs.

mikson60 commented 4 years ago

Hi, I am having the same issue. Here is a link to the unity editor log and the steamvr system report: link I am using Unity 2019.3.3f1 and tried using the new Open XR plugin with legacy steam vr input. I also have Oculus XR Plugin installed. I am also using the old, standard/built-in render pipeline. No URP or HDRP. I am running the application in Linear Color space. I also noticed that a known issue in wiki is that "OpenVR Mirror View Mode (default) can cause black screens in the game view". I tried setting it to None, but no difference in the Editor. Whenever I try to play in editor, it crashes. It seems that the unity process does get connected to the steam vr application, however as soon as the game becomes playable (it does render a frame or more) it crashes. It also does not matter if there is a XR rig or even a camera in a scene or no. It still crashes. When I create a Windows build and execute it, the application just has a black screen on my computer monitor and nothing happens, no matter how long I wait. It seems the SteamVR does not even try to start the application and it still stays in Steam Home. Though the FPS in Steam Home (while looking through the Vive headset) is dropped significantly while the malfunctioning executable is running. I hope this gets fixed asap, otherwise without having the ability to test in editor nor the build, this plugin is simply unusable.

Hi @mikson60 - setting it to None should stop any rendering in the Editor, are you still getting a preview even with this setting?

Not sure if I get the preview. It crashes anyways. It crashes even when the scene is empty and I hit play. I can check tomorrow if the first few frames are rendered before the crash.

hmm.. this could be something different/unrelated. are you able to share some logs here or if there's any sensitive info you dont want to share in public, you can send them to runeb@valvesoftware.com

It probably is related. Because if I remove the OpenXR package, the problem goes away. The link in my first comment has 2 logs: unity editor log with crash at the end and the steamvr system log.

QThund commented 4 years ago

Do you have any estimations of when is the next version going to be released? Thank you for your hard work fixing this.

DrummerB commented 4 years ago

The OpenVR package still makes Unity crash on play. Oculus also just broke my Rift with their latest update. I'm running out of working setups.

0lento commented 4 years ago

I finally got this running on the player build by using SteamVR beta from Steam (got a tip about this from Unity staff) + doing these fixes to the package: https://github.com/ValveSoftware/steamvr_unity_plugin/issues/738#issuecomment-642986518

Package fixes also here on my fork: https://github.com/0lento/steamvr_unity_plugin/tree/UnityXRPlugin (fixes black screen on build + IL2CPP building).

kroecks commented 4 years ago

Can confirm; still happening in 2019.4.3f1 Can also confirm; @0lento 's fix totally works. And it's a one line change.

zite commented 4 years ago

I believe this has been fixed in preview-5. To upgrade go to the Unity Package Manager, select OpenVR XR Plugin, and click Update in the lower right hand corner. If you're using SteamVR Unity Plugin you'll want to update to beta 3 here: https://github.com/ValveSoftware/steamvr_unity_plugin/releases/tag/2.6.0b3 If you're on preview-3 or below you'll need to remove it from the package manager and install using the installer found here: https://github.com/ValveSoftware/unity-xr-plugin/releases/tag/installer

nhf75 commented 4 years ago

The only way that I finded is setting Rendering Path to Foward in your Camera, OpenVr Stereo Rendering Mode to Multi Pass and Mirror View Mode to None. Unfortunately.

kisak-valve commented 4 years ago

Closing per @zite's last comment.

Hello @nhf75, please open a new issue report for your follow up issue if it hasn't been already.