• Unity
  • Services
  • Made with Unity
  • Learn
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Forums
  • Answers
  • Feedback
  • Issue Tracker
  • Blog
  • Evangelists
  • User Groups

Navigation

  • Home
  • Unity
  • Industries
  • Made with Unity
  • Learn
  • Community
    • Forums
    • Answers
    • Feedback
    • Issue Tracker
    • Blog
    • Evangelists
    • User Groups
  • Get Unity
  • Asset Store

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by obiolg · Mar 26, 2015 at 07:43 AM · androidgyroscopegyrounityremotesysteminfo

Problem with Gyro in Unity Android project

I would like to get a reference to Gyroscope and retreive its rotationRate.

Using code like this:

 ...
 void Start() {
   if (SystemInfo.supportsGyroscope) {
     gyro = Input.gyro;
     gyro.enabled = true;
   }
 }
 
 void Update() {
   if (gyro.enabled) {
     Debug.Log("Gyro: " + gyro.rotationRate);
   }
 }
 ...

The problem is that SystemInfo.supportsGyroscope returns false. gyro.enabled = true; doesn't do the trick, since Gyroscope.attitude keeps returning (0, 0, 0) object.

I am using Unity v5 along with Unity Remote 4, and have Dell Venue 7 connected for quick debugging. Everything worked fine just 2 weeks ago with Unity v4. Now, after upgrade it stopped working.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Ekta Mehta D. · Mar 26, 2015 at 11:58 AM 0
Share

Some of the device does not support gyroscope.

avatar image fredcicles · Mar 19, 2016 at 03:10 AM 0
Share

Did you ever get anywhere with this?

avatar image Ali-hatem · Mar 19, 2016 at 02:41 PM 0
Share

why you need a reference just use if (Input.gyro.enabled) gyro documentation click me

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by meat5000 · Mar 19, 2016 at 02:45 PM

Use accelerometer instead

https://unity3d.com/learn/tutorials/modules/beginner/platform-specific/accelerometer-input

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

25 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Using Gyroscope with Android 1 Answer

How should I interpret the gyro's information? 0 Answers

Input.gyro.attitude not working on newer Android devices 2 Answers

Strange android gyrometer attitude angles 1 Answer

[Android] How do you set gyro start orientation 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges