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

    Class Mouse

    A mouse input device.

    Inheritance
    System.Object
    InputControl
    InputDevice
    Pointer
    Mouse
    Inherited Members
    Pointer.position
    Pointer.delta
    Pointer.radius
    Pointer.pressure
    Pointer.press
    Pointer.Accumulate(InputControl<Single>, Void*, InputEventPtr)
    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.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 Mouse : Pointer, IInputStateCallbackReceiver
    Remarks

    Adds a scroll wheel and a typical 3-button setup with a left, middle, and right button.

    To control cursor display and behavior, use .

    Properties

    backButton

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

    clickCount

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

    current

    The mouse that was added or updated last or null if there is no mouse connected to the system.

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

    forwardButton

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

    leftButton

    The left mouse button.

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

    middleButton

    The middle mouse button.

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

    rightButton

    The right mouse button.

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

    scroll

    The horizontal and vertical scroll wheels.

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

    Methods

    FinishSetup()

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

    MakeCurrent()

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

    OnAdded()

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

    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
    Pointer.OnRemoved()

    WarpCursorPosition(Vector2)

    Move the operating system's mouse cursor.

    Declaration
    public void WarpCursorPosition(Vector2 position)
    Parameters
    Type Name Description
    Vector2 position

    New position in player window space.

    Remarks

    The position property will not update immediately but rather will update in the next input update.

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