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.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.TryGetChildControl(String)
    InputControl.TryGetChildControl<TControl>(String)
    InputControl.GetChildControl(String)
    InputControl.GetChildControl<TControl>(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

    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

    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 . 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 ).

    press

    Whether the pointer is pressed down.

    Declaration
    public ButtonControl press { get; }
    Property Value
    Type Description
    ButtonControl
    Remarks

    What this means exactly depends on the nature of the pointer. For mice (Mouse), it means that the left button is pressed. For pens (Pen), it means that the pen tip is touching the screen/tablet surface. For touchscreens (Touchscreen), it means that there is at least one finger touching the screen.

    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

    Methods

    Accumulate(InputControl<Single>, Void*, InputEventPtr)

    Declaration
    protected static void Accumulate(InputControl<float> control, void *oldStatePtr, InputEventPtr newState)
    Parameters
    Type Name Description
    InputControl<System.Single> control
    System.Void* oldStatePtr
    InputEventPtr newState

    FinishSetup()

    Declaration
    protected override void FinishSetup()
    Overrides
    InputControl.FinishSetup()

    MakeCurrent()

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

    OnEvent(InputEventPtr)

    Declaration
    protected void OnEvent(InputEventPtr eventPtr)
    Parameters
    Type Name Description
    InputEventPtr eventPtr

    OnNextUpdate()

    Declaration
    protected void OnNextUpdate()

    OnRemoved()

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

    Explicit Interface Implementations

    IInputStateCallbackReceiver.OnNextUpdate()

    Declaration
    void IInputStateCallbackReceiver.OnNextUpdate()
    Implements
    IInputStateCallbackReceiver.OnNextUpdate()

    IInputStateCallbackReceiver.OnStateEvent(InputEventPtr)

    Declaration
    void IInputStateCallbackReceiver.OnStateEvent(InputEventPtr eventPtr)
    Parameters
    Type Name Description
    InputEventPtr eventPtr
    Implements
    IInputStateCallbackReceiver.OnStateEvent(InputEventPtr)

    Extension Methods

    InputControlExtensions.IsActuated(InputControl, Single)
    InputControlExtensions.ReadValueAsObject(InputControl)
    InputControlExtensions.ReadValueIntoBuffer(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*, 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>)

    See Also

    Mouse
    Pen
    Touchscreen
    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