Class Pen
A pen/stylus input device.
Inherited Members
Namespace: UnityEngine.InputSystem
Syntax
public class Pen : Pointer, IInputStateCallbackReceiverRemarks
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 | 
tip
The tip button of the pen.
Declaration
public ButtonControl tip { get; }Property Value
| Type | Description | 
|---|---|
| ButtonControl | 
See Also
Methods
FinishSetup(InputDeviceBuilder)
Declaration
protected override void FinishSetup(InputDeviceBuilder builder)Parameters
| Type | Name | Description | 
|---|---|---|
| InputDeviceBuilder | builder | 
Overrides
MakeCurrent()
Declaration
public override void MakeCurrent()Overrides
OnRemoved()
Declaration
protected override void OnRemoved()