OnApplicationFocus(false) not called on simulator

Unity2022.3.18f1
com.unity.xr.visionos@1.0.3
xcode 15.2

Application running foreground, click simulator’s “Home” button, Application running background but OnApplicationFocus(false) not called.

Hi @GameFinder

If you haven’t done so already, can you please create a bug report (Unity Editor Main Menu > Help > Report a bug) and then include the incident report ID here?

Thanks!
–Tim

I had a similar problem on device. OnApplicationFocus and OnApplicationPause are not called when press the crown for the VR app.

I noticed similar, is there any update on this?

Both OnApplicationFocus() and OnApplicationPause() are not being called on our builds when I take the app to the background and bring it back.

I am using 2023.3.20f1, Xcode 15.3, App mode MixedReality.

1 Like

You can use the WindowEvents on the VolumeCamera to get this info in the meantime. That helped me get the behaviour I was after from OnApplicationPause/OnApplicationFocus.

https://docs.unity3d.com/Packages/com.unity.polyspatial.visionos@1.1/manual/VolumeCamera.html

2 Likes

Thank you! Those events work very well.

VR Mode No Volume Camera , How i get window Event?

You are correct; in VR mode you don’t get window events from a VolumeCamera. If you are finding in the latest version of Unity with the latest package versions (1.2.3) that you are still not getting OnApplicationFocus and OnApplicationPause called in the right situations, please submit a bug report with a project that replicates the issue, along with the expected behavior you would like to see. visionOS signals the app about these states a little differently than on iOS or other platforms, and we may have still missed an edge case here or there.

Thanks for your patience, and good luck!