Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug New Input system breaks gyro support :(

Discussion in 'Input System' started by petey, Oct 19, 2020.

  1. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Hi all,

    I just realised the new Input system breaks the gyro support on iOS.
    SystemInfo.supportsGyroscope always returns false.
    (This is in Unity 2019.4 LTS with Input system 1.0.0)

    Does anyone know a way to hack this into working?
    I'm too far in with the new system to revert back to the old input system.

    Thanks,
    Pete
     
  2. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Ah, my guess is the "Active Input Handling" player setting is disabling the path that initializes that property. Likely needs to get looked at. Would you mind filing a ticket with the Unity bug reporter? ("Help >> Report a Bug..." in the editor's main menu)

    For a workaround, my guess is that setting "Active Input Handling" in the player settings to "Both" should probably get the property initialized properly again.
     
  3. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Okay, I put a bug report in. (Case 1285994). I’ll check out those settings first thing tomorrow and see how it goes. :)
    Thanks,
    P.
     
  4. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Thank you :)
     
  5. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Cool, setting to both worked. Thanks for that :)
     
  6. ExNinja

    ExNinja

    Joined:
    Dec 4, 2013
    Posts:
    29
    Confirming that setting "Active Input Handling" to "Both" in Player Settings does work on iOS in 2020.2.0b10.

    (Initially, this post was me reporting that it didn't work, but there was a bug in my code that was actually the culprit.)
     
    Last edited: Nov 7, 2020
    tantx likes this.
  7. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
  8. ExNinja

    ExNinja

    Joined:
    Dec 4, 2013
    Posts:
    29
    Thanks, @petey. My problem was actually another bug that I've fixed now. I've updated my post. Thank you again for the feedback. :)
     
    petey likes this.
  9. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    75
    In 2021 this is still a problem. I use 2020.3.12 (LTS for reason)

    I created a simple scene where the smartphone controls the camera rotation. I wanted to use the new InputSystem. The result:

    - on android it works at first start, but if you pause the app and then resume, the gyro won't work again
    - on ios the gyro does not work

    I switched back and used the old input system and everything works.

    So I'd like to ask the unity team, to create a simple gyro app for an iPhone and during this journey please fix the bugs.
    One one the first anoying thing is

    'Gyroscope' is an ambiguous reference between 'UnityEngine.InputSystem.Gyroscope' and 'UnityEngine.Gyroscope'

    But this is just the beginning and at the end it does not work reliable.
     
    MilenaRocha likes this.
  10. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Would you mind filing a ticket with the Unity bug reporter? ("Help >> Report a Bug..." in the editor's main menu)

    Which version of the input system package? I believe gyro support for iOS landed in one of the 1.1 preview versions.
     
  11. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    75
    I used the verified 1.0.2 version. Good to know, that it is worked on. In the docs I read that gyro sensor in iOS with new input system is supported already.

    I'll clean the code to easily switch the input systems, update unity version and write a bug report, hopefully this week...
     
  12. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Hmm, digging through the changelog pretty sure I was wrong about gyro support and 1.1 previews. The stuff happening in the previews was about other sensors in iOS. Must be something else then. Might be worth firing a ticket off about this one, too. To my knowledge, this should be working just fine.
     
  13. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    75
    I filled a but report: (Case 1362730) Gyroscope / Attitude Sensor Problem on Android after pausing app
     
  14. noemis

    noemis

    Joined:
    Jan 27, 2014
    Posts:
    75
    I filled another bugreport about IOS with an updated project.
    (Case 1362779) Gyroscope / Attitude sensor problem on IOS using the new Input System
     
  15. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,771
    Hey I just noticed the weird order on the Input system packages so I updated to 1.1.0-pre.6 from 1.1.0-preview.3 and that broke gyro support for me.

    Now when I try to start the gyro
    Code (CSharp):
    1. gyroScope = UnityEngine.InputSystem.Gyroscope.current;
    I get - Gyro not available

    It was working in 1.1.0-preview.3 on my iPad and iPhone (haven't tested on Android yet sorry).
    I rolled back to 1.1.0-preview.3 so I have something to test with for the time being but I was wondering, is that likely to come back?
     
    Last edited: Sep 6, 2021
    tantx likes this.
  16. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    248
    UnityEngine.InputSystem.Gyroscope.current does not send me the correct value at each frame. It gives me (0,0,0) for at least 10sec on my phone then gives me some value, then freeze randomly