- Home /
Input.acceleration always returns zero on specific project
Hi so Im stuck with the following problem developing for Android - Input.acceleration always returns zero, but only on specific project. The accelerometer works fine on other projects, but I get zero on a specific project in more than one device. So I am wondering if there are any project settings that can disable Input.acceleration.
Answer by eddyjohnson3 · Mar 21, 2014 at 02:32 PM
Turns out the MobileCore ads that I was trying out were to blame. Their SDK is somehow completely desabling the gyro.
Answer by Arshia001 · Mar 20, 2014 at 06:42 PM
There is, actually: It's called Input.GyroEnabled or something like that if I remember correctly. Just look through all of Input's properties, you'll know which one it is. I think it has Gyro in the name, so if you've already looked for "AccelerationEnabled" and not found it, look again and you'll see it.
I tried: Input.gyro.enabled = true;
Unfortunately it did not help. Gyro on the same project works fine on iOS. Really starnge...
Answer by YourGamesBeOver · Mar 21, 2014 at 02:07 PM
I've heard of people having issues similar to this; something not working in just one project when it really should. The only general solution I've seen is to export your entire project as a .unitypackage, then make a new project and import it. It seems to fix a lot of problems, and it's worth a shot.
Answer by joonturbo · Apr 14, 2017 at 12:39 PM
There is an AccelerometerFrequency setting, only visible int he Player settings inspector for iOS builds.
I was developing on Android, and using Cloudbuild to build for iOS. This setting is invisible in my editor, but you can go into ProjectSettings\ProjectSettings.asset and find accelerometerFrequency: 0 and set it to 30 or 60
More info here: http://answers.unity3d.com/questions/894979/inputaccelerometer-always-returning-zero.html
Your answer
![](https://koobas.hobune.stream/wayback/20220613140742im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Please, can anyone explain this (input.acceleration) 3 Answers
Detect if an acceleration sensor exist 1 Answer
Incremental acceleration with Imput 1 Answer
Detect phone sliding movement across table 0 Answers
Detection of device fall 0 Answers