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

[New Input System] Current Device

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

  1. opdenis

    opdenis

    Joined:
    Jan 23, 2017
    Posts:
    15
    ok, I could not get working StepCounter, so I started from the beginning - the tutorials.
    I opened the manual:
    https://docs.unity3d.com/Packages/c...pi/UnityEngine.InputSystem.Accelerometer.html
    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

    frpe1

    Joined:
    May 4, 2020
    Posts:
    10
    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)
    InputSystem.EnableDevice(Accelerometer.current);

    That did the trick for me