How do I get pen pressure values in Unity (using S Pen on Android)?

1.5k Views Asked by At

I've looked everywhere and there's no actual examples or tutorials regarding using tablet pens with Unity.

I tried using the GetTouch function I found on a forum just to see if that would work:

float pressure = Input.GetTouch(0).pressure;

then displaying the value as a string to see it's value, but I get a "Index out of bound" error.

1

There are 1 best solutions below

2
On

First you have to install the package Input System

enter image description here

After that you have to add the namespace UnityEngine.InputSystem to your script (line 2).

enter image description here

The value can be read with Pointer.current.pressure.clampConstant

Further information can be found here