Detect headset took on/off in VisionOS

Hello,

I’m developing a VisionOS app for an event. The app will be tried by many users on the same headset, so it is essential to be able to detect when a user takes off the headset so that the app can be returned to its initial state.
Is there a way to do this properly?

Thanks in advance,
Alessio

Haven’t tried it myself, but the volume camera has an event for that.

Yeah I’d recommend looking into the Volume Camera Events as @unnanego mentioned. The one caveat being there isn’t a specific event for don and doff. You might get focused or backgrounded events. Note you would also get these events when the user is interacting with other content in OS.

Thanks @unnanego, I was able to get the desired behaviour by leveraging on the Volume Camera WindowEvent.