unity-game-enginegyroscope

How to add a gyroscope control binding to Input Actions panel in Unity's new Input System


I would like to add gyroscope/accelerometer control binding to the Input Actions panel in Unity's new input system.

On the Input Actions panel, I see we can bind all kinds of inputs from game controllers to touchscreens and even "listen" for them as we bind an input, but gyro inputs (on smartphones/tablets/gamepads) appear to be missing unless I am not looking properly. I tried "listen" as I tilt the tablet which didn't register anything.

Using a Samsung Galaxy s6 lite 2022 which has Gyro and accelerometer. My test project builds and run successfully (in development mode) to the tablet, so its communicating fine.

Using Unity version 2022.2.17

Is there a way to add this gyro/accelerometer input controls to the Input Actions panel? I rather stick with new Input System rather than revert to legacy input scripting.

Thanks


Solution

  • Did you change the Action's control type to Vector 3? The dropdown auto filters bindings based on the control type of the action. Once you have the action set to Vector 3 you should find the path to all of the phone bindings under "Sensor".

    Input Actions Window Example