• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • 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
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

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
Question by mantinone · Apr 27, 2014 at 10:37 PM · windowsaccelerometergyroscopesurfacegyro

How do I access the Accelerometer and Gyroscope on my Surface Pro?

I'm trying to make a simple tilt-control game.

I figured that the easiest way to test motion controls as I code them was to work on my Surface Pro, since it's basically a full PC with Accelerometer and Gyro. Problem is, Unity doesn't seem to be recognizing these sensors when I test the game in the editor.

I tried the test code from the script reference on a cube "transform.rotation = Input.gyro.attitude;" And nothing happens. I tried printing the attitude and Input.acceleration and all I get are "(0.0, 0.0, 0.0, 1.0)" and "(0.0, 0.0, 0.0)" respectively, no matter how much I twist and shake the device.

I do currently have my build settings on Windows Store Apps.

So... how can I make Unity recognize my Surface's sensors?

Comment
jonathan______
greenland
0not
vanessagoncalves
nt314p
japhwil

People who like this

6 Show 1
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 jonathan______ · Nov 10, 2015 at 12:57 AM 0
Share

i have the same problem so if u got any news so far id be happy if u or someone else could share those :p

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Jason_N · Mar 07, 2016 at 10:19 AM

I found this. When running in unity editor via the Play button the accelerometer doesn't work. I built it (as a Windows Universal store app, via visual studio), then it worked correctly as a standalone app

Comment

People who like this

0 Show 6 · 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
avatar image TallBrian · Jul 23, 2017 at 11:09 PM 0
Share

@jason_N I expect that the accelerometer works in a windows Uni App (built in visual studio). But how do you get it to work in Unity?

avatar image CraigGraff · Jul 24, 2017 at 12:06 AM 0
Share

Have you tried this? Input.gyro.enabled = true;

avatar image DanVioletSagmiller · Mar 20, 2018 at 05:48 PM 0
Share

@Jason_N Building it did not work. (running on Surface Pro 5) @CraigGraff I did try Input.gyro.enabled, but it did nothing.
SystemInfo.supportsGyroscope returns false in IDE or EXE :(

avatar image CraigGraff DanVioletSagmiller · Mar 20, 2018 at 07:27 PM 0
Share

I assume you've already realized this, but SystemInfo.supportsGyroscope returning false means that your hardware does not have a gyroscope to read from (or at least doesn't have one that Unity supports).

avatar image DanVioletSagmiller DanVioletSagmiller · Mar 21, 2018 at 02:20 AM 0
Share

Building to pc did not work. building to UWP did. The hardware turned out to work, just not in the IDE. same issue as above. :(

avatar image DanVioletSagmiller DanVioletSagmiller · Mar 21, 2018 at 02:21 AM 0
Share

SystemInfo.supportsGyroscope returns true in a build and false in the ide on the same hardware.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

Does Gyro sensor increase battery consumption? 0 Answers

How to get highest value for acceleration from Input.gyro 0 Answers

detect 360 spin on mobile device 1 Answer

New Gyroscope Controls in Unity 4? 2 Answers

VR Camera using Input.acceleration 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges