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.

[New Input System] Current Device

Discussion in 'Input System' started by opdenis, May 6, 2020.

  1. opdenis


    Jan 23, 2017
    ok, I could not get working StepCounter, so I started from the beginning - the tutorials.
    I opened the manual:
    So I copied and pasted the code:
    Code (CSharp):
    1.     protected void OnEnable()
    2.     {
    3.         // All sensors start out disabled so they have to manually be enabled first.
    4.         InputSystem.EnableDevice(Accelerometer.current);
    5.     }
    Run and open LogCat:
    What's the problem with SENSORS? Does somebody know how to get them to work?
    Virtumonde and js3422 like this.
  2. frpe1


    May 4, 2020
    I though it was an error to, but on my device when running the app, it works just fine. But when pressing play in unity I get this result. Not sure if that was the case for you, but handling with an try-catch could come in handy or simple use

    if (Accelerometer.current != null)

    That did the trick for me