Unity-Android-Sensor-Plugin icon indicating copy to clipboard operation
Unity-Android-Sensor-Plugin copied to clipboard

Cannot get it working in Unity

Open smartcharge opened this issue 6 years ago • 2 comments

I am using Unity version 5.x and I can't seem to get the accelerometer readings from my Android device. I placed the .jar file in the Assets folder like you said, and used the C# template (SensorBehaviour.cs) like you said, but I am getting nothing. I am rather new to Unity so I suspect I am missing something obvious and was wondering if you could point me in the right direction.

For the record, I used the AndroidSensorPlugin.jar that you provided a link to, AND I downloaded the Android Studio Project (Unity-Android-Sensor-Plugin-develop) and compiled a new .jar file that I placed in the Assets folder, but neither solution worked.

A little background about the project I'm working on. I made a simple FPS that works fine with the mouse and keyboard. Now I want to replace the mouse with the rotation vector from my Android device, but I am starting small and simply using the accelerometer to make sure I am getting everything working correctly. Once I get the accelerometer working I can replace it with the rotation vector.

smartcharge avatar Mar 21 '18 17:03 smartcharge

Assets/Plugins/Android/AndroidSensorPlugin.jar this way?

reigota avatar Mar 22 '18 11:03 reigota

Yup, exactly that way.

I'm still playing around with the configuration settings in Unity, I'm sure I'll eventually get it, I just want to get it sooner rather than later and hoped some one could help me save time.

smartcharge avatar Mar 22 '18 17:03 smartcharge