What the accelerometer is?
The accelerometer is, in a nutshell, a chip installed in your smartphone which detects all the phone movements.
How to implement accelerometer data in Unity 5?
We can get the data through Input.acceleration
Here, to use Input.acceleration.x and Input.acceleration.y was enough to obtain a movement on the transform.position.
It’s easy, doesn’t it?
However, implement motion through input.acceleration, is not always recommended. In many cases, in fact, we will have a GameObject moving crazy and without logic, so it’s better transform the data before rotate the GameObject.
Process the accelerometer data before rotate the GameObject.
This is an example:
As you can see, I Lerped and adjusted input.acceleration values before using them, and I've got the desired result.
More information about accelerometer input are available here on the official Unity Learn section
I hope this tip has been helpful and that you can efficiently use the accelerometer to create your own video games in Unity 5!
Riccardo