Accelerometer frequency depends on fps

I have a fixed time step at 0.003333333 and 30fps (so that's 10 physics steps per frame, I need that for accuracy). I need as much accelerometer samples as I can get. So I sample the accelerometer at each FixedUpdate.

To know when a new accelerometer sample is available, I test whether iPhoneInput.GetAccelerationEvent(0).deltaTime has changed since last FixedUpdate (it seems to be the only way to detect that).

My problem is that accelerometer frequency is throttled to FPS.

I tried playing the loop type constants in xCode, to no avail. Accelerometer frequency is always the same as FPS.

EDIT: I actually get as many samples as kAccelerometer frequency, it's just that it's updated at each "Update" rather than at each "FixedUpdate". That means I get the data but with much delay. Maybe it's enough though. I'll see.

From the Unity documentation (which i cannot seem to find on Unity's website...) -- try experimenting with these values...

Tuning Main Loop Performance

Setting up desired frame-rate Unity iPhone allows you to tweak how many times per second your application will try to execute its rendering loop. By default it is 30 times per second. By lowering this number your application will save more battery power, but will render fewer frames per second. By increasing this value, rendering will be prioritized over other activities such as touch input and accelerometer processing. You will need to experiment with the frame-rate selection and determine for yourself the impact it has on your specific game.

If your application is computational or rendering heavy and can maintain say only 15 frames per second, then setting desired frame rate over 15 wouldn't make any sense. First you have to optimize your application, then increase desired frame-rate.

To set the desired frame-rate, open your XCode project generated by Unity iPhone, and select the AppController.mm file. Locate and change #define kFPS 30 to a desired value, for example: #define kFPS 60.

Tuning accelerometer processing frequency

A high frequency of accelerometer input processing might have a negative impact on overall performance of your game. By default iPhone Unity application will query the accelerometer input 60 times per second. You might discover an additional performance improvement by lowering the accelerometer frequency or even setting it to 0, if your game is not using the accelerometer at all.

To specify desired processing frequency for the accelerometer you will have to open the Unity generated XCode project, select AppController.mm file and change #define kAccelerometerFrequency 60 to a different value, for example: define kAccelerometerFrequency 10

To test if accelerometer events have occurred since the last frame:

if (iPhoneInput.accelerationEventCount > 0) { ... }

edit:

it seems the queue size is always 1! So this isn't much of a guard condition.