ARKit loses tracking on configuration change

I’m allowing a user to choose camera feed’s FPS and resolution by selecting respective
XRCameraConfiguration and assigning chosen configuration to arCameraManager.currentConfiguration.

This works fine but during the change there’s noticeable lag in the camera feed and apparently session isn’t tracking for couple seconds. If device is physically moved/rotated, all virtual objects end up in a different place. Here’s a video: https://youtube.com/shorts/iOxtP5JJ6Dk

I understand that when session is interrupted by the config change it’s not tracking and hence the drift, but is there a way to restore/resume tracking properly somehow?

Using ARFoundation 5.0 on ARKit

How is that object placed? Are you using anchors? Anchors would be the way to ensure that content remains in place even if the session relocalizes. (And if anchors aren’t working for this, that sounds like a possible bug)

Sorry for the delayed reply, I can confirm that having an anchor does help the session recover, and it seems that an anchor in more or less arbitrary location recovers the whole session, not just the object attached to the anchor. It’s another question how to position it best, but at least I know where to start

I would recommend checking out our samples: GitHub - Unity-Technologies/arfoundation-samples: Example content for Unity projects based on AR Foundation