docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct MouseState

    Combine a single pointer with buttons and a scroll wheel.

    Implements
    IInputStateTypeInfo
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    Namespace: UnityEngine.InputSystem.LowLevel
    Assembly: Unity.InputSystem.dll
    Syntax
    public struct MouseState : IInputStateTypeInfo

    Fields

    buttons

    Button mask for which buttons on the mouse are currently pressed.

    Declaration
    public ushort buttons
    Field Value
    Type Description
    ushort

    Button state mask.

    See Also
    MouseButton
    leftButton
    middleButton
    rightButton
    forwardButton
    backButton

    clickCount

    Number of clicks performed in succession.

    Declaration
    public ushort clickCount
    Field Value
    Type Description
    ushort

    Successive click count.

    See Also
    clickCount

    delta

    Screen-space motion delta of the mouse in pixels.

    Declaration
    public Vector2 delta
    Field Value
    Type Description
    Vector2

    Mouse movement.

    See Also
    delta

    displayIndex

    The index of the display that was moused.

    Declaration
    public ushort displayIndex
    Field Value
    Type Description
    ushort

    position

    Screen-space position of the mouse in pixels.

    Declaration
    public Vector2 position
    Field Value
    Type Description
    Vector2

    Position of mouse on screen.

    See Also
    position

    scroll

    Scroll-wheel delta of the mouse.

    Declaration
    public Vector2 scroll
    Field Value
    Type Description
    Vector2

    Scroll wheel delta.

    See Also
    scroll

    Properties

    Format

    Memory format identifier for MouseState.

    Declaration
    public static FourCC Format { get; }
    Property Value
    Type Description
    FourCC

    Returns "MOUS".

    See Also
    format

    format

    Returns Format.

    Declaration
    public FourCC format { get; }
    Property Value
    Type Description
    FourCC
    See Also
    format

    Methods

    WithButton(MouseButton, bool)

    Set the button mask for the given button.

    Declaration
    public MouseState WithButton(MouseButton button, bool state = true)
    Parameters
    Type Name Description
    MouseButton button

    Button whose state to set.

    bool state

    Whether to set the bit on or off.

    Returns
    Type Description
    MouseState

    The same MouseState with the change applied.

    See Also
    buttons

    Implements

    IInputStateTypeInfo
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)