Game closes with HMD Plugged in

Hi everyone !

I have some trouble with my project when I try to use OpenXR.
For the context: I’ve exported some code we produced on a project which was running on UE4.23 and SteamVR and try to use it on UE4.27 with steam VR. Everything was fine until I try to run a build of the project: the controllers are not tracked and a window from SteamVR appears telling me that it needs keybinding for this project. I’ve read somewhere that new projects doesn’t works well with SteamVR, is that right ?

I tried with a project made from the VR template and everything works well, hands are tracked and no in game popup appears to ask for keybinding. So I chose to follow the settings of this project. I found out that this project doesn’t use the SteamVR plugin and use OpenXR instead. So I disabled the SteamVR plugin in my project.

The problem now is that the build closes almost instantly (it’s not crashing, it just closes itself). I dug into the engine to find out where the exit request is called and found the line, it’s from the OpenXRHMD.cpp file in the FOpenXRHMD::OnStartGameFrame(FWorldContext& WorldContext) method. It seems that the method catches an OpenXR event which is XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING which results in an exit request in build. I must have missed something but I don’t know what. The problem appears only if the headset is plugged in. Does someone have any idea ?

Update !

I dug a bit more into the FOpenXRHMD::OnStartGameFrame() method with some breakpoint debug. I was wrong, it is a XR_SESSION_STATE_EXITING of a XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED that was tringerring the exit request (i didn’t see that the break at the end of the case was conditionnally called.

At some point the ReadNextEvent method gets XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED and its state is XR_SESSION_STATE_STOPPING which calls StopSession() which, I assume, raise state changed event with the XR_SESSION_STATE_EXITING state leading to the exit request

Ok, it was just a blueprint command node to disable stereo mode without any checks on the conditions to disable it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.