Class Pointer | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class Pointer

    Base class for pointer-style devices moving on a 2D screen.

    Inheritance
    System.Object
    InputControl
    InputDevice
    Pointer
    Mouse
    Pen
    Touchscreen
    Inherited Members
    InputDevice.InvalidDeviceId
    InputDevice.LocalParticipantId
    InputDevice.description
    InputDevice.enabled
    InputDevice.canRunInBackground
    InputDevice.added
    InputDevice.remote
    InputDevice.native
    InputDevice.updateBeforeRender
    InputDevice.id
    InputDevice.lastUpdateTime
    InputDevice.wasUpdatedThisFrame
    InputDevice.allControls
    InputDevice.valueType
    InputDevice.valueSizeInBytes
    InputDevice.all
    InputDevice.ReadValueFromBufferAsObject(Void*, Int32)
    InputDevice.ReadValueFromStateAsObject(Void*)
    InputDevice.ReadValueFromStateIntoBuffer(Void*, Void*, Int32)
    InputDevice.CompareValue(Void*, Void*)
    InputDevice.OnAdded()
    InputDevice.ExecuteCommand<TCommand>(TCommand)
    InputControl.name
    InputControl.displayName
    InputControl.shortDisplayName
    InputControl.path
    InputControl.layout
    InputControl.variants
    InputControl.device
    InputControl.parent
    InputControl.children
    InputControl.usages
    InputControl.aliases
    InputControl.stateBlock
    InputControl.noisy
    InputControl.synthetic
    InputControl.Item[String]
    InputControl.ToString()
    InputControl.EvaluateMagnitude()
    InputControl.EvaluateMagnitude(Void*)
    InputControl.WriteValueFromBufferIntoState(Void*, Int32, Void*)
    InputControl.WriteValueFromObjectIntoState(Object, Void*)
    InputControl.CompareState(Void*, Void*, Void*)
    InputControl.TryGetChildControl(String)
    InputControl.RefreshConfigurationIfNeeded()
    InputControl.RefreshConfiguration()
    InputControl.m_StateBlock
    InputControl.currentStatePtr
    InputControl.previousFrameStatePtr
    InputControl.defaultStatePtr
    InputControl.noiseMaskPtr
    InputControl.stateOffsetRelativeToDeviceRoot
    Namespace: UnityEngine.InputSystem
    Syntax
    public class Pointer : InputDevice, IInputStateCallbackReceiver
    Remarks

    Note that a pointer may have "multi-point" ability as is the case with multi-touch where multiple touches represent multiple concurrent "pointers". However, for any pointer device with multiple pointers, only one pointer is considered "primary" and drives the pointer controls present on the base class.

    Properties

    button

    Declaration
    public ButtonControl button { get; }
    Property Value
    Type Description
    ButtonControl

    current

    The pointer that was added or used last by the user or null if there is no pointer device connected to the system.

    Declaration
    public static Pointer current { get; }
    Property Value
    Type Description
    Pointer

    delta

    Declaration
    public Vector2Control delta { get; }
    Property Value
    Type Description
    Vector2Control

    displayIndex

    Declaration
    public IntegerControl displayIndex { get; }
    Property Value
    Type Description
    IntegerControl

    phase

    Declaration
    public PointerPhaseControl phase { get; }
    Property Value
    Type Description
    PointerPhaseControl

    pointerId

    Declaration
    public IntegerControl pointerId { get; }
    Property Value
    Type Description
    IntegerControl

    position

    The current pointer coordinates in window space.

    Declaration
    public Vector2Control position { get; }
    Property Value
    Type Description
    Vector2Control
    Remarks

    Within player code, the coordinates are in the coordinate space of the Display space that is current according to displayIndex. When running with a single display, that means the coordinates will always be in window space of the first display.

    Within editor code, the coordinates are in the coordinate space of the current . This means that if you query in , for example, the returned 2D vector will be in the coordinate space of your local GUI (same as ).

    pressure

    Normalized pressure with which the pointer is currently pressed while in contact with the pointer surface.

    Declaration
    public AxisControl pressure { get; }
    Property Value
    Type Description
    AxisControl
    Remarks

    This is only meaningful for pointing devices that support pressure. Mice do not, pens usually do, and touch usually does on mobile platforms.

    Note that it is possible for the value to go above 1 even though it is considered normalized. The reason is that calibration on the system can put the maximum pressure point below the physically supported maximum value.

    radius

    Declaration
    public Vector2Control radius { get; }
    Property Value
    Type Description
    Vector2Control

    tilt

    Declaration
    public Vector2Control tilt { get; }
    Property Value
    Type Description
    Vector2Control

    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

    AccumulateDelta(Void*, Void*, InputControl<Single>)

    Declaration
    protected void AccumulateDelta(void *oldStatePtr, void *newStatePtr, InputControl<float> control)
    Parameters
    Type Name Description
    System.Void* oldStatePtr
    System.Void* newStatePtr
    InputControl<System.Single> control

    FinishSetup(InputDeviceBuilder)

    Declaration
    protected override void FinishSetup(InputDeviceBuilder builder)
    Parameters
    Type Name Description
    InputDeviceBuilder builder
    Overrides
    InputControl.FinishSetup(InputDeviceBuilder)

    MakeCurrent()

    Declaration
    public override void MakeCurrent()
    Overrides
    InputDevice.MakeCurrent()

    OnRemoved()

    Declaration
    protected override void OnRemoved()
    Overrides
    InputDevice.OnRemoved()

    ResetDelta(Void*, InputControl<Single>)

    Declaration
    protected bool ResetDelta(void *statePtr, InputControl<float> control)
    Parameters
    Type Name Description
    System.Void* statePtr
    InputControl<System.Single> control
    Returns
    Type Description
    System.Boolean

    Explicit Interface Implementations

    IInputStateCallbackReceiver.OnBeforeWriteNewState(Void*, Void*)

    Declaration
    void IInputStateCallbackReceiver.OnBeforeWriteNewState(void *oldStatePtr, void *newStatePtr)
    Parameters
    Type Name Description
    System.Void* oldStatePtr
    System.Void* newStatePtr
    Implements
    IInputStateCallbackReceiver.OnBeforeWriteNewState(Void*, Void*)

    IInputStateCallbackReceiver.OnCarryStateForward(Void*)

    Declaration
    bool IInputStateCallbackReceiver.OnCarryStateForward(void *statePtr)
    Parameters
    Type Name Description
    System.Void* statePtr
    Returns
    Type Description
    System.Boolean
    Implements
    IInputStateCallbackReceiver.OnCarryStateForward(Void*)

    IInputStateCallbackReceiver.OnReceiveStateWithDifferentFormat(Void*, FourCC, UInt32, ref UInt32)

    Declaration
    bool IInputStateCallbackReceiver.OnReceiveStateWithDifferentFormat(void *statePtr, FourCC stateFormat, uint stateSize, ref uint offsetToStoreAt)
    Parameters
    Type Name Description
    System.Void* statePtr
    FourCC stateFormat
    System.UInt32 stateSize
    System.UInt32 offsetToStoreAt
    Returns
    Type Description
    System.Boolean
    Implements
    IInputStateCallbackReceiver.OnReceiveStateWithDifferentFormat(Void*, FourCC, UInt32, ref UInt32)

    Extension Methods

    InputControlExtensions.IsActuated(InputControl, Single)
    InputControlExtensions.ReadValueAsObject(InputControl)
    InputControlExtensions.ReadValueIntoBuffer(InputControl, Void*, Int32)
    InputControlExtensions.ReadDefaultValue(InputControl, Void*, Int32)
    InputControlExtensions.ReadDefaultValueAsObject(InputControl)
    InputControlExtensions.WriteValueFromObjectIntoEvent(InputControl, InputEventPtr, Object)
    InputControlExtensions.WriteValueIntoState(InputControl, Void*)
    InputControlExtensions.WriteValueIntoState<TValue>(InputControl, TValue, Void*)
    InputControlExtensions.WriteValueIntoEvent<TValue>(InputControl, TValue, InputEventPtr)
    InputControlExtensions.CheckStateIsAtDefault(InputControl)
    InputControlExtensions.CheckStateIsAtDefault(InputControl, Void*, Void*)
    InputControlExtensions.CheckStateIsAtDefaultIgnoringNoise(InputControl)
    InputControlExtensions.CheckStateIsAtDefaultIgnoringNoise(InputControl, Void*)
    InputControlExtensions.CompareStateIgnoringNoise(InputControl, Void*)
    InputControlExtensions.CompareState(InputControl, Void*, Void*)
    InputControlExtensions.HasValueChangeInState(InputControl, Void*)
    InputControlExtensions.HasValueChangeInEvent(InputControl, InputEventPtr)
    InputControlExtensions.GetStatePtrFromStateEvent(InputControl, InputEventPtr)
    InputControlExtensions.FindControlsRecursive<TControl>(InputControl, IList<TControl>, Func<TControl, Boolean>)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023