Unity loses focus when Oculus display activated

Hi!

I’m running a VR simulation in Unity using the Oculus Rift. I run this simulation in the Unity editor rather than building because the simulation stays in-house and does not need to be distributed. When the Rift goes from standby to active (when the sensor inside the headset is activated), the Unity window loses focus (presumably, focus is shifted to the Oculus app, although the app does not become unminimized and I have no way to verify this). This is specifically a problem for me because when Unity loses focus the Graphics Raycaster stops doing ray casts, which are necessary for my user interface (I’m using the OVRInputModule and OVRRaycaster which sits on top of the GraphicsRaycaster).

This was not happening a couple months ago. I can’t say exactly when it started, but I think it happened either with a Unity update or with an Oculus update.

This is extremely inconvenient for me, since I’m running user studies with multiple VR backpacks and I have to remote into the backpacks to control each Unity simulation. As each user puts on and takes off the HMDs, I have to remote into each and click on Unity to restore focus.

Does anyone know how to prevent this, how to automatically give Unity back focus, or how to get the Graphics Raycaster raycast method to continue being called even when Unity loses focus?

Thanks!

I have this exact issue as well and it makes it extremely frustrating to diagnose the new input system because it compounds the problem of needing the Rift S to detect eyes before turning on.
steps needed to read console output:

- hit play in editor
- put on headset and wait for load
- lift headset off and click player window to grab focus
- put headset BACK on to maintain active
- trigger input even on controller
- take headset OFF AGAIN to read console or input debugger

I’m more upset that it took me three days to figure out this problem and it was only serendipitously by clicking the window randomly.

I’ll be building in a console viewer now to receive debug.log in headset now for sure. if only to cut down on repro steps.