Returns specific acceleration measurement which occurred during last frame. (Does not allocate temporary variables).
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Update() { Vector3 acceleration = Vector3.zero; int i = 0; while (i < Input.accelerationEventCount) { AccelerationEvent accEvent = Input.GetAccelerationEvent(i); acceleration += accEvent.acceleration * accEvent.deltaTime; ++i; } print(acceleration); } }