Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Bug [New InputSystem] Sensors stop working after app loses focus (like opening keyboard)

Discussion in 'Input System' started by ceast33, Jan 14, 2021.

  1. ceast33

    ceast33

    Joined:
    Apr 22, 2020
    Posts:
    9
    Whatever their value was at the moment I open the keyboard, they will return the same after even if my Android device is moved around.

    many values like:
    AttitudeSensor.current.attitude.ReadValue()
    Accelerometer.current.acceleration.ReadValue()
    LinearAccelerationSensor.current.acceleration.ReadValue()

    (And Gyroscope.current.angularVelocity.ReadValue() rarely works for me (even before opening keyboard), which I posted in previous thread)

    Im using Unity 2020.1.10f1, & we are migrating to the new InputSystem.
     
  2. ceast33

    ceast33

    Joined:
    Apr 22, 2020
    Posts:
    9
    Also happens when the app loses focus!
     
  3. mdroxas

    mdroxas

    Joined:
    Jul 30, 2018
    Posts:
    2
    Did you find a fix?
     
  4. ceast33

    ceast33

    Joined:
    Apr 22, 2020
    Posts:
    9
    I made a workaround! I disable the sensor in OnApplicationFocus(false) and re-enable it OnApplicationFocus(true).
     
  5. ceast33

    ceast33

    Joined:
    Apr 22, 2020
    Posts:
    9
    It doesnt work for the Gyroscope though (which what I was using before the Input System Migration)