Moving character in Unity3D based on accelerometer input
I know absolutely nothing about c# or unity3d, so if there's a language specific assist, I have no idea about it!

I notice each condition checks Input.acceleration.y, so that's one bit of information that repeats. I also notice we have three speeds, yet we have seven conditionals!

First of all, the negatives are confusing. Find the absolute value first.

I'm going to assume a number followed by an "f" means float. So maybe we need something like:

float acceleration = Math.Abs(Input.acceleration.y);


Great, now it's going to be easier to handle this!

Now all we need is a simple check like so:

if (acceleration &lt; 0.2f) {
    maxSpeed = 17;
} else if (acceleration &lt; 0.9f) {
    maxSpeed = 25;
} else {
    maxSpeed = 40;
}


Your original numbers were a little weird, but if you meant for such a strange pattern, correct me!