Class Pen
A pen/stylus input device.
Inherited Members
Namespace: UnityEngine.InputSystem
Syntax
public class Pen : Pointer, IInputStateCallbackReceiver
Remarks
Unlike mice but like touch, pens are absolute pointing devices moving across a fixed surface area.
The tip acts as a button that is considered pressed as long as the pen is in contact with the tablet surface.
Properties
current
The pen that was active or connected last or null
if there is no pen.
Declaration
public static Pen current { get; }
Property Value
Type | Description |
---|---|
Pen |
eraser
The eraser button of the pen, i.e. the button on the end opposite to the tip.
Declaration
public ButtonControl eraser { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
Remarks
If the pen does not have an eraser button, this control will still be present but will not trigger.
See Also
firstBarrelButton
The button on the side of the pen barrel and located closer to the tip of the pen.
Declaration
public ButtonControl firstBarrelButton { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
Remarks
If the pen does not have barrel buttons, this control will still be present but will not trigger.
See Also
fourthBarrelButton
Declaration
public ButtonControl fourthBarrelButton { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
inRange
Button control that indicates whether the pen is in range of the tablet surface or not.
Declaration
public ButtonControl inRange { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
Remarks
This is a synthetic control (synthetic).
If range detection is not supported by the pen, this button will always be "pressed".
See Also
Item[PenButton]
Declaration
public ButtonControl this[PenButton button] { get; }
Parameters
Type | Name | Description |
---|---|---|
PenButton | button |
Property Value
Type | Description |
---|---|
ButtonControl |
secondBarrelButton
The button on the side of the pen barrel and located closer to the eraser end of the pen.
Declaration
public ButtonControl secondBarrelButton { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
Remarks
If the pen does not have barrel buttons, this control will still be present but will not trigger.
See Also
thirdBarrelButton
Declaration
public ButtonControl thirdBarrelButton { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
tilt
Declaration
public Vector2Control tilt { get; }
Property Value
Type | Description |
---|---|
Vector2Control |
tip
The tip button of the pen.
Declaration
public ButtonControl tip { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
See Also
twist
Rotation of the pointer around its own axis. 0 means the pointer is facing away from the user (12 'o clock position) and ~1 means the pointer has been rotated clockwise almost one full rotation.
Declaration
public AxisControl twist { get; }
Property Value
Type | Description |
---|---|
AxisControl |
Remarks
Twist is generally only supported by pens and even among pens, twist support is rare. An example product that supports twist is the Wacom Art Pen.
The axis of rotation is the vector facing away from the pointer surface when the pointer is facing straight up (i.e. the surface normal of the pointer surface). When the pointer is tilted, the rotation axis is tilted along with it.
Methods
FinishSetup()
Declaration
protected override void FinishSetup()
Overrides
MakeCurrent()
Declaration
public override void MakeCurrent()
Overrides
OnRemoved()
Declaration
protected override void OnRemoved()