How do I set framerate for iOS in AR?

I have been trying to set target framerate for iOS and Android devices. I have an option for users to select 30 or 60 fps. However, when I go into AR (AR Foundation) mode, the device automatically switches to 60 fps even though I have it explicitly set to 30. When I exit AR mode, the framerate stays at 60 fps, it does not go back down to 30 fps (user set).

Is there a way to force AR to limit to 30 fps or does AR just disregard what the user setting is?

The main reason I am doing this is to reduce battery drain, and expose that option to users. I know a higher framerate means the plane/mesh detection occurs more often if it is targeting 60 fps. We have tried using Application.targetFrameRate as well as setting ARSession.matchFrameRate but it seems to be overridden when AR is activated.

Please disable the ARSession.matchFrameRate. With this option enabled AR Foundation sets Application.targetFrameRate to match camera video framerate.

1 Like

After reading the docs, I now see that the camera itself can be limited to 60 fps only which means you can’t force it to 30. Are there any other parameters I could use to limit how much AR scanning is occurring?

Just set the ARSession.matchFrameRate to false, then set Application.targetFrameRate to the desired framerate.

“Are there any other parameters I could use to limit how much AR scanning is occurring?”
As far as I know: No.

The ‘scanning’ is being taken care of by ARKit/ARCore. Similar to how you can’t set the ‘framerate’ for the OS, you can’t set it for the scanning SDK.
What you CAN do, is either change how often you handle the results, or what you do with it.

“The main reason I am doing this is to reduce battery drain”
Your best bet here would be reducing the ‘accuracy’ on some of the objects (e.g. turning down the density for meshing on iOS).
Of course targeting a lower framerate for you application, as suggested by Kirill above, would also reduce the resources you are using (and thus increase battery life), but the underlying system would still run at the same rate, as it is a separate process from Unity.

2 Likes