material
Import the InputSystem package
- Package Manager searches for Input System to download
- Enabling this package will restart the Unity Editor
Notice
InputSystem can be used with older versions of the input system.
Settings: Project Settings->Player->Other Settings->Configuration->Active Input Handling
parameters are optional: Input Manager (old), Input System Package (New), Both
mouse interaction
Get the current mouse
Mouse.current
Mouse pointer position (screen space)
mouse.position.ReadValue() 类似Input.mousePosition
Interaction of left, right and middle mouse buttons
mouse.leftButton.isPressed 鼠标左键保持按下
mouse.leftButton.wasPressedThisFrame 鼠标左键按下
mouse.leftButton.wasReleasedThisFrame 鼠标左键抬起
mouse.rightButton.isPressed 鼠标右键保持按下
mouse.middleButton.isPressed 鼠标中键保持按下
mouse wheel
mouse.scroll.y.ReadValue() 鼠标滚轮滚动值
mouse movement
mouse.delta.ReadValue() 鼠标移动增量 类似 Mouse X 和Mouse Y的组合