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?
(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
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.
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.
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.
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.