Pen/Stylus input

Hello,
I am trying to get pressure input from my Wacom tablet. According to the InputSystem documentation, it seems very easy and Wacom is even explicitely mentioned (Pen/Tablet/Stylus Support | Package Manager UI website). However, I do not receive any values when trying to read anything from Pen.current (position, pressure etc). For instance, Pen.current.pressure.ReadValue() is always 0. The new input system is setup and otherwise works in my project (mouse, keyboard works and Pen is added as device).

Interestingly, I literally found no example for pen/stylus input in Unity (or I used the wrong search terms) and very little on using pressure input in general. I have a running example in WPF, but that would be a lot of overhead to connect to Unity. Has anyone managed to get this to work directly in Unity using the new input system? Is there an initialization step that I am missing?

Thanks,

-Andreas

Bump, I’m having the same exact issue.
Is there anything we’re missing here?

Thanks!

Same here, happy about any input (pun intended). Is this a bug we should file? (no because it is a known issue, see below)

Update:

In the Input System docs, under “Known Limitations”, it says:

(Windows) Pen input will not work with Wacom devices if “Windows Ink” support is turned off.

When I turn Windows Ink on in the Wacom Tablet Settings, and then restart all Unity Instances, I get pen pressure readings. But there is a reason all of us have “Windows Ink” off - it just … doesn’t work very well.

Big Bummer: When I turn Windows Ink on, I cannot press anything inside Unity’s own UI using the Wacom pen (like the “Play” button or anything in the inspector… Does anyone have a solution for this?

Here’s a little snippet with some info for testing:
Unity version used: 2020.2.1f1, Input System Package 1.0.2

using UnityEngine;
using UnityEngine.InputSystem;

public class InputTest : MonoBehaviour {
   
    // look in the inspector to see the values update
    public float pointerPressure = 0;
    public bool pointerPressed;

    public float penPressure = 0;

    public bool penTipPressed;
    public bool penIsHovering;

    public Vector2 mousePos;

    void Update() {
        // "Pen", "Pointer" and "Mouse" must be added to "Supported Devices" in "Project Settings"->"Input System Package"
        // for being available for use
        Pointer pointer = Pointer.current;
        Pen pen = Pen.current;
        Mouse mouse = Mouse.current;

        // only returns a value >0 until pointer is moved after pressing
        pointerPressure = pointer.pressure.ReadValue();
     
        // works
        pointerPressed = pointer.press.isPressed;

        // works, iff:
        // - Windows Ink is on in Wacom Tablet Properties
        //   note: all Unity instances must be restarted after toggling this setting
        penPressure = pen.pressure.ReadValue();
        penTipPressed = pen.tip.isPressed;
        penIsHovering = pen.inRange.isPressed;
     
        // works (if Mouse is added to Suported Devices)
        if (mouse != null) {
            mousePos = mouse.position.ReadValue();
         
        }
    }
}

Any news on this?
I too can not get my wacom pen to work probably.
Either i can not right click, that is fixed by turning windows ink on in Wacom settings, but then I can not select anything left clicking in Unity.
My wacom pen is useless, and I really, really want to it to work :frowning:

Also experiencing the same issues with wacom tablet

-windows ink on: able to read pen input in-game, but cannot click Unity UI
-windows ink off: able to click Unity UI, but cannot use in-game

Unity should definitely find a mode that works for both

1 Like

The same here. I was thinking about simulating mouse events as a workaround. Thus I can still use pen features like pressure with Windows Ink enabled. Just put it in Update method.
7659364--955750--upload_2021-11-15_22-25-46.png

I can also confirm that this issue happens with Dell Active Pen in Windows 10 that works via MPP (Microsoft Pen Protocol). Here is what happened when the pen touches the screen. We have inRange, pressure and coordinates, but not a PRESS FACT. Windows Ink is enabled in this case. Disabling Windows Ink or turning ON Mouse Mode makes it working as a mouse, but we can no longer get pressure and other pen-specific values.

I’ve just created a bug https://fogbugz.unity3d.com/default.asp?1381551_u040aucdrarvm9bu

1 Like

In the latest alpha 2022.1.0a15.2209 my pen now works in the editor, but now at runtime it’s constantly sending me PointerUpEvents for the pen, then sending mouse events instead of pen events for a few frames (using the pen’s position but with 0 pressure), and then switching back to the pen.

1 Like

Please create a bug, they may not read this forum.

Kind of related because about pressure support on a platform: Can we use pressure for editor tools now ? I know its possible for Mac but I need also windows
https://docs.unity3d.com/Packages/com.unity.inputsystem@1.2/manual/Pen.html

@dmytro_at_unity @Rene-Damm Pinging you as you may have answers :). input for editor tools status ?

Amazing! thanks a lot, i have a HUION tablet and the same problem. your code helped me fix some of it, thanks again!

https://docs.unity3d.com/ScriptReference/UIElements.PointerEventBase_1.html

Pressure should work in 2022.1+.

Keep in mind that we currently only support reading pen-specific metrics with Windows Ink. We don’t support wintab as retrofitting it would have been incredibly costly resource-wise.

1 Like

Yes its working! Could you please add an example in the docs ?
so people who want to integrate it can do so easily
Thanks!

BTW, there are a lot of pen improvements in 2022. This includes some support for pen input in the editor as well.

Many of the features are new to 2022, however, and won’t be backported.

1 Like

Yes the editor has support now, will the terrain painting and polybtush also get official pressure support?

I have this running with YAPP and like to see more unity tools support it

https://www.youtube.com/watch?v=b1FQQmsfB7o

2 Likes