This commit is contained in:
2026-11-24 15:51:02 +01:00
parent cca4d73e41
commit f4aa17114a
22092 changed files with 5042406 additions and 0 deletions
@@ -0,0 +1,5 @@
inputactions
playerinput
inputsystemuiinputmodule
gravitysensor
deadzone
@@ -0,0 +1,23 @@
---
uid: input-system-actions
---
# Actions
**Actions** allow you to separate the purpose of an input from the device controls which perform that input, and associate the purpose and device controls together in a flexible way.
For example, the purpose of an input in a game might be to make the player's character move. The device control associated with that action might be the left gamepad stick.
To associate an action with one or more device controls, you set up input bindings in the [Input Actions Editor](actions-editor.md). Then you can refer to those actions in your code, instead of the specific devices. The input bindings define which device's controls are used to perform the action. For example this screenshot shows the "Move" action's bindings to the left gamepad stick and the keyboard's arrow keys.
![The Actions panel of the Input Actions Editor in Project Settings](Images/ActionsBinding.png)<br/>
*The Actions panel of the Input Actions Editor in Project Settings*
When you get a reference to an action in your code, you can use it to check its value, or attach a callback method to be notified when it is performed. For a simple example script demonstrating this, refer to [Workflow Overview - Actions](using-actions-workflow.md).
Actions also make it simpler to create a system that lets your players [customize their bindings at runtime](rebind-action-runtime.md), which is a common requirement for games.
> [!NOTE]
> - Actions are a runtime only feature. You can't use them in [Editor window code](https://docs.unity3d.com/ScriptReference/EditorWindow.html).
>
> - You can read input without using actions and bindings by directly reading specific device controls. This is less flexible, but can be quicker to implement for certain situations. Read more about [directly reading devices from script](using-direct-workflow.md).
>
@@ -0,0 +1,34 @@
---
uid: input-system-architecture
---
# Architecture
The Input System has a layered architecture that consists of a low-level layer and a high-level layer.
# Native backend
The foundation of the Input System is the native backend code. This is platform-specific code which collects information about available Devices and input data from Devices. This code is not part of the Input System package, but is included with Unity itself. It has implementations for each runtime platform supported by Unity. This is why some platform-specific input bugs can only be fixed by an update to Unity, rather than a new version of the Input System package.
The Input System interfaces with the native backend using [events](input-events.md) that the native backend sends. These events notify the system of the creation and removal of [Input Devices](devices.md), as well as any updates to the Device states. For efficiency and to avoid creating any garbage, the native backend reports these events as a simple buffer of raw, unmanaged memory containing a stream of events.
The Input System can also send data back to the native backend in the form of [commands](device-commands.md) sent to Devices, which are also buffers of memory that the native backend interprets. These commands can have different meanings for different Device types and platforms.
# Input System (low-level)
![Low-Level Architecture](Images/InputArchitectureLowLevel.png)
The low-level Input System code processes and interprets the memory from the event stream that the native backend provides, and dispatches individual events.
The Input System creates Device representations for any newly discovered Device in the event stream. The low-level code sees a Device as a block of raw, unmanaged memory. If it receives a state event for a Device, it writes the data from the state event into the Device's [state representation](control-state.md) in memory, so that the state always contains an up-to-date representation of the Device and all its Controls.
The low-level system code also contains structs which describe the data layout of commonly known Devices.
# Input System (high-level)
![High-Level Architecture](Images/InputArchitectureHighLevel.png)
The high-level Input System code interprets the data in a Device's state buffers by using [layouts](layouts.md), which describe the data layout of a Device and its Controls in memory. The Input System creates layouts from either the pre-defined structs of commonly known Devices supplied by the low level system, or dynamically at runtime, as in the case of [generic HIDs](hid-specification.md).
Based on the information in the layouts, the Input System then creates [Control](controls.md) representations for each of the Device's controls, which let you read the state of each individual Control in a Device.
As part of the high-level system, you can also build another abstraction layer to map Input Controls to your application mechanics. Use [Actions](actions.md) to [bind](bindings.md) one or more Controls to an input in your application. The Input System then monitors these Controls for state changes, and notifies your game logic using [callbacks](set-callbacks-on-actions.md). You can also specify more complex behaviors for your Actions using [Processors](processors.md) (which perform processing on the input data before sending it to you) and [Interactions](Interactions.md) (which let you specify patterns of input on a Control to listen to, such as multi-taps).
@@ -0,0 +1,19 @@
---
uid: input-system-contributing
---
# Contribute to the Input System source code
The [full source code](https://github.com/Unity-Technologies/InputSystem) for the Input System is available on GitHub. This is also where most of the Input System's development happens.
> [!NOTE]
> This includes the full source code for the managed/C# part of the system. At this point, the native, platform-specific C++ backends are still closed-source and require a source code license.
## Reporting bugs
To report documentation problems, please use the feedback section at the bottom of the page containing the problem.
To report bugs related to the Input System Please follow Unity's standard [bug reporting guidelines](https://unity3d.com/unity/qa/bug-reporting). Don't forget to submit a Project that the developer who picks up your report can use to reproduce the issue. Be sure to mention that the bug is specific to the Input System package in the description, so it gets forwarded to the correct team at Unity.
## Discussion
To ask questions or discuss the Input System, see the [dedicated section on Unity's forum](https://forum.unity.com/forums/new-input-system.103/). This is also the best place to post feature requests.
@@ -0,0 +1,25 @@
---
uid: input-debugging
---
# Debugging
Learn how to investigate and troubleshoot the Input System when something isn't working as expected.
| **Topic** | **Description** |
| :--- | :--- |
| **[The input debugger window](the-input-debugger-window.md)** | Open the Input Debugger to inspect devices, actions, users, and layouts in the Editor and connected players. |
| **[Debug a device](debug-device.md)** | Inspect a device's controls, state, and events in the Input Debugger. |
| **[Debug an action](debug-action.md)** | Verify enabled actions, bindings, and mapped controls during Play mode. |
| **[Debug users and PlayerInput](debug-users-playerinput.md)** | Inspect InputUser and Player Input pairings, devices, and actions in the Users list. |
| **[Debug layouts](debug-layouts.md)** | Browse registered control and device layouts in the Input Debugger. |
| **[Trace actions](trace-actions.md)** | Generate a log of all activity that happened on a particular set of Actions. |
| **[Visualizers](visualizers.md)** | Monitor controls and actions in real time with the Visualizers sample. |
| **[Device Simulation](device-simulation.md)** | Learn how the Unity Device Simulator feeds touchscreen input into the Input System. |
## Additional resources
- [See and record input event flow](see-record-input-event-flow.md)
- [Testing](testing.md)
- [Binding resolution](binding-resolution.md)
- [Debug Player Input Component](debug-player-input-component.md)
@@ -0,0 +1,9 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
}
}
@@ -0,0 +1,22 @@
---
uid: input-system-editor-features
---
# Editor features
Use the Input System while developing in the Unity Editor—not only during Play mode in a built player.
Read input from custom Editor windows, stream touch and sensor data from a mobile device with Unity Remote, and trace or record how events flow through the system.
| **Topic** | **Description** |
| :--- | :--- |
| **[Read input in Editor Windows](read-input-editor-windows.md)** | Read pen, keyboard, and other device input from `EditorWindow` code outside Play mode. |
| **[Use mobile device input in the Editor (Unity Remote)](use-mobile-device-input-editor-unity-remote.md)** | Stream mobile touch and sensor input into the Editor while in Play mode using the Unity Remote app. |
| **[See and record input event flow](see-record-input-event-flow.md)** | Trace and record events with `InputEventTrace` to inspect how input moves through the system. |
## Additional resources
- [Debugging](debugging.md)
- [The input debugger window](the-input-debugger-window.md)
- [Testing](testing.md)
- [See and record input event flow](see-record-input-event-flow.md)
@@ -0,0 +1,56 @@
---
uid: input-system-how-do-i
---
# How do I…?
A collection of frequently asked questions, and where to find their answers in the documentation.
> **Note:**
>
> If you're new to the Input System and have landed on this page looking for documentation, it's best to read the [QuickStart Guide](quick-start-guide.md), and the [Concepts](understanding-input.md) and [Workflows](Workflows.md) pages, so that you can make sure you're choosing the best workflow for your project's input requirements.
>
> This is because there are a number of different ways to read input using the Input System, and many of the answers on this page give you the quickest but least flexible solution, and may not be suitable for a project with more complex requirements.
How do I...?
- [check if a specific key or button was pressed this frame?](xref:UnityEngine.InputSystem.Controls.ButtonControl)
- [check if any key or button was pressed](xref:UnityEngine.InputSystem.InputSystem)
- [find all connected gamepads?](xref:UnityEngine.InputSystem.Gamepad)
- [find the gamepad that the player is currently using?](xref:UnityEngine.InputSystem.Gamepad)
- [know when a new device was plugged in?](monitor-devices.md)
- [create my own custom devices?](hid-create-custom-layout.md)
- create a simple "Fire" type action?</br>
Use the same techniques shown for the "Jump" action in the [Workflows section](Workflows.md)
- [require a button to be held down for some duration before triggering an action?](built-in-interactions.md#hold)
- [use a "positive" and a "negative" button to drive an axis?](configure-bindings-from-code.md#1d-axis)
- [create a UI to rebind input in my game?](xref:UnityEngine.InputSystem.InputActionRebindingExtensions)
- [set up an Action to specifically target the left-hand XR controller?](xref:UnityEngine.InputSystem.XR.XRController)
- [make my left-hand XR controller my right-hand one?](xref:UnityEngine.InputSystem.XR.XRController)
- [get all current touches from the touchscreen?](touch-polling.md#read-all-touches)
- [deal with my gamepad data arriving in a format different from `GamepadState`?](xref:UnityEngine.InputSystem.LowLevel.GamepadState)
- [force the Input System to use my own layout when the native backend discovers a specific Device?](native-devices.md)
- [add deadzoning to my gamepad sticks?](query-gamepads.md#add-a-deadzone-to-a-gamepad)
- [give my head tracking an extra update before rendering?](xref:UnityEngine.InputSystem.XR.XRHMD)
- [record events flowing through the system?](see-record-input-event-flow.md)
- [see events as they're processed?](see-record-input-event-flow.md)
- [see what Devices I have and what state they're in?](debug-device.md)
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
@@ -0,0 +1,54 @@
---
uid: input-system-installation
---
# Install the Input System package
Install the Input System package and enable the input back end for your project.
## Install the package
Unity 6.1 and later include the Input System package in projects created from some templates.
If your project doesn't include the Input System package, you can install it:
1. In the main menu, go to **Window** > **Package Manager**.
1. Go to **Unity Registry**.
1. From the package list, select **Input System**.
1. Select **Install**.
1. Follow any prompts to [enable the backends](#select-a-back-end).
## Select a back end
The Unity Editor has two back end options:
- The Input Manager for backwards compatibility.
- The Input System package for new or upgraded projects.
When you install the Input System package in your project, Unity asks whether to enable the Input System back ends. Select **Yes** to enable the Input System back ends and disable the Input Manager back ends. The Editor restarts to complete the change.
To manually select a back end:
1. In the main menu, go to **Edit** > **Project Settings** > **Player**.
1. In the **Other Settings** section, set **Active Input Handling** to select a back end:
- Input Manager (Old): Builds have the `ENABLE_LEGACY_INPUT_MANAGER=1` C# `#define`.
- Input System Package (New): Builds have the `ENABLE_INPUT_SYSTEM=1` C# `#define`.
- Both: Builds have both of the C# `#define`.
The Editor restarts with a new back end.
## Import samples and demos
The Input System package includes several samples. To import a sample into your project:
1. Go to **Window** > **Package Manager**.
1. Select the Input System package.
1. Select **Samples**.
1. To import a sample, select **Import** next to its name.
For a more comprehensive demo, use the [Warriors](https://github.com/UnityTechnologies/InputSystem_Warriors) project.
## Additional resources
* [Quickstart guide](quick-start-guide.md)
* [Migrate from the old input system](migrate-from-old-input-system.md)
* [Input System workflows](Workflows.md)
@@ -0,0 +1,22 @@
---
uid: input-system-interactions
---
# Interactions
Use interactions to interpret specific input patterns from controls that define action behavior.
| **Topic** | **Description** |
| :--- | :--- |
| [**Introduction to interactions**](introduction-interactions.md) | Use interactions on bindings and actions to read control input patterns and trigger Actions. |
| [**Apply interactions to bindings**](apply-interactions-bindings.md) | Apply interactions to individual bindings. |
| [**Apply interactions to actions**](apply-interactions-actions.md) | Apply Interactions to actions, and all the bindings associated with that action. |
| [**Predefined interactions**](predefined-interactions.md) | Use the Input System's default and built-in interactions on your actions and bindings. |
| [**Write custom interactions**](write-custom-interactions.md) | Write your own custom interactions for your actions and bindings. |
## Additional resources
- [Bindings](bindings.md)
- [Processors](processors.md)
- [Configure actions](configure-actions.md)
- [Responding to input](respond-to-input.md)
@@ -0,0 +1,36 @@
---
uid: input-system-known-limitations
---
# Known limitations
The following is a list of known limitations that the Input System currently has.
## Compatibility with other Unity features
* Input processing in the background is tied to `Application.runInBackground` (That is, the "Run In Background" setting in "Player Preferences") which, however, Unity always forces to `true` in __development__ players. This means that in development players, input will always be processed, even if the app is in the background. Of course, this only pertains to platforms where the player can actually run in the background (iOS and Android are thus unaffected).
* `PlayerInput` split-screen support does not work with Cinemachine virtual cameras.
* The Input System cannot generate input for IMGUI.
* UI Toolkit can be used with `InputSystemUIInputModule` but only pointer (mouse, pen, touch) and gamepad input is supported at the moment. XR support is coming.
* Also, UI Toolkit support currently requires use of an `EventSystem` setup in order to interface the Input System with UITK.
### uGUI
* After enabling, the UI will not react to a pointer's position until the position is changed.
* The new input system cannot yet feed text input into uGUI and TextMesh Pro input field components. This means that text input ATM is still picked up directly and internally from the Unity native runtime.
* The UI will not consume input such that it will not also trigger in-game actions.
## Device support
* Currently, devices whose input sources depend on application focus (generally, keyboards and pointers but can be any device depending on platform) will not automatically sync their current state when the app loses and subsequently regains focus. This means that, for example, if the W key is held when application comes back into the foreground, the key needs to be depressed and pressed again for the input to come through.
* This is being worked on.
* (Desktop) We do not yet support distinguishing input from multiple pointers (mouse, pen, touch) or keyboards. There will be a single Mouse, Pen, Touch, and Keyboard device.
* (Windows) Pen input will not work with Wacom devices if "Windows Ink" support is turned off.
* (Windows) HID input is not currently supported in 32-bit players. This means that devices such as the PS4 controller will not work in 32-bit standalone players. Use the 64-bit standalone player instead.
* (Android) We only support a single Touchscreen at the moment.
* Joy-Cons are only supported on Switch.
* Sensors in the PS4 controller are currently only supported on PS4.
Note: Support for NDA platforms is distributed as separate packages due to licensing restrictions. The packages, at this point, are made available separately to licensees for download and installation.
## Features Supported by Old Input Manager
* Unity Remote doesn't currently support the Input System. This is being worked on.
@@ -0,0 +1,25 @@
---
uid: input-system-layouts
---
# Layouts
Define how the Input System represents input devices and controls in memory.
Layouts are an advanced feature you use when you support custom devices or change how existing devices behave. Each layout describes a memory format for input and the controls that read and write that data. The Input System uses layouts to create the correct device types and interpret incoming input.
For end-to-end custom device setup, refer to [Custom devices](custom-devices.md).
| **Topic** | **Description** |
| :--- | :--- |
| **[About layouts](about-layouts.md)** | Learn what layouts are, how the Input System loads them, and when you need them. |
| **[Layout formats](layout-formats.md)** | Add layouts from C# types, JSON, or the layout builder API. |
| **[Layout inheritance](layout-inheritance.md)** | Derive a layout from an existing layout to reuse and extend control definitions. |
| **[Control items](control-items.md)** | Configure the controls in a layout and set their properties. |
| **[Override layout definitions](override-layout-definitions.md)** | Change an existing layout without replacing the original definition. |
| **[Precompiled layouts](precompiled-layouts.md)** | Speed up device creation by baking layouts into precompiled C# code. |
## Additional resources
- [Custom devices](custom-devices.md)
- [Debug layouts](debug-layouts.md)
- [Human Interface Device specification](hid-specification.md)
@@ -0,0 +1,22 @@
---
uid: input-system-processors
---
# Processors
Use an input processor to apply processing to input values and return the result. For example, you can use a [clamp](built-in-processors.md) processor to clamp values to within a certain range.
| **Topic** | **Description** |
| :--- | :--- |
| [**Introduction to processors**](introduction-to-processors.md) | Learn what processors can do to alter input values, and how they interact with bindings, actions, and controls. |
| [**Built-in processors**](built-in-processors.md) | Explore the processors that come built into the Input System. |
| [**Write custom processors**](write-custom-processors.md) | Create and register your own processors for use with bindings, actions, and controls. |
| [**Add processors to bindings and actions**](add-processors-bindings-actions.md) | Add processors to individual bindings, or to all bindings on an action, with the Editor or with code. |
| [**Add processors to controls**](add-processors-controls.md) | Add processors to specific control inputs, including custom controls. |
## Additional resources
- [Bindings](bindings.md)
- [Interactions](Interactions.md)
- [Configure actions](configure-actions.md)
- [Configure bs from code](configure-bindings-from-code.md)
@@ -0,0 +1,7 @@
---
uid: input-system-settings
---
To configure the Input System individually for each project, go to __Edit__ > __Project Settings…__ > __Input System Package__ from Unity's main menu.
This section describes each input setting in detail.
@@ -0,0 +1,265 @@
* [Introduction](index.md)
* [Install the Input System package](Installation.md)
* [Concepts](understanding-input.md)
* [Workflows](Workflows.md)
* [Using the Actions Workflow](using-actions-workflow.md)
* [Using the PlayerInput Workflow](using-playerinput-workflow.md)
* [Using the Direct Workflow](using-direct-workflow.md)
* [Video resources](videos.md)
* [Quick start guide](quick-start-guide.md)
* [Setting up input](setting-up-input.md)
* [Actions](actions.md)
* [Input action assets](action-assets.md)
* [About action assets](about-action-assets.md)
* [About project-wide actions](about-project-wide-actions.md)
* [Create and assign a default project-wide actions asset](create-project-wide-actions.md)
* [Create an empty action asset](create-empty-action-asset.md)
* [Assign an existing action asset as project-wide](assign-project-wide-actions.md)
* [Default actions](default-actions.md)
* [Generate C# API from actions](generate-cs-api-from-actions.md)
* [Create action maps](create-edit-delete-action-maps.md)
* [Create, edit and delete actions](create-edit-delete-actions.md)
* [Configure actions](configure-actions.md)
* [Action and control types](action-and-control-types.md)
* [About action and control types](about-action-control-types.md)
* [Configure action type](configure-action-type.md)
* [Action types reference](action-type-reference.md)
* [Configure control type](configure-control-type.md)
* [Bindings](bindings.md)
* [Introduction to bindings](introduction-to-bindings.md)
* [Binding types](binding-types.md)
* [Composite bindings](composite-bindings.md)
* [Add, duplicate or delete a binding](add-duplicate-delete-binding.md)
* [Select a control for binding](select-control-binding.md)
* [Edit composite bindings](edit-composite-bindings.md)
* [Group bindings to control schemes](group-binding-to-control-scheme.md)
* [Binding resolution](binding-resolution.md)
* [Restrict binding to a specific device](restrict-binding-resolution-to-device.md)
* [Binding conflicts](binding-conflicts.md)
* [Initial state checks](binding-initial-state-checks.md)
* [Controls](controls.md)
* [Introduction to controls](introduction-to-controls.md)
* [Control hierarchies](control-hierarchies.md)
* [Control types reference](control-types-reference.md)
* [Control usages](control-usages.md)
* [Control paths](control-paths.md)
* [Control state](control-state.md)
* [Record control state history](record-control-state-history.md)
* [Control actuation](control-actuation.md)
* [Noisy controls](noisy-controls.md)
* [Synthetic controls](synthetic-controls.md)
* [Optimizing controls](optimize-controls.md)
* [Controls schemes](control-schemes.md)
* [Interactions](Interactions.md)
* [Introduction to interactions](introduction-interactions.md)
* [Apply interactions to bindings](apply-interactions-bindings.md)
* [Apply Interactions to actions](apply-interactions-actions.md)
* [Predefined interactions](predefined-interactions.md)
* [Default Interactions](default-interactions.md)
* [Built-in Interactions](built-in-interactions.md)
* [Write custom interactions](write-custom-interactions.md)
* [Processors](processors.md)
* [Introduction to processors](introduction-to-processors.md)
* [Built-in processors](built-in-processors.md)
* [Write custom processors](write-custom-processors.md)
* [Add processors to bindings and actions](add-processors-bindings-actions.md)
* [Add processors to controls](add-processors-controls.md)
* [Input Actions Editor references](actions-editor.md)
* [Input Actions Editor window reference](input-actions-editor-window-reference.md)
* [Action Properties panel reference](action-properties-panel-reference.md)
* [Binding Properties panel reference](binding-properties-panel-reference.md)
* [Control Schemes and Devices menu reference](control-schemes-devices-menu-reference.md)
* [Configure input from code](configure-input-from-code.md)
* [Declare stand alone actions](declare-standalone-actions.md)
* [Configure input from JSON](configure-input-from-json.md)
* [Create actions in code](create-actions-in-code.md)
* [Configure bindings from code](configure-bindings-from-code.md)
* [Responding to input](respond-to-input.md)
* [About responding to input](about-responding-to-input.md)
* [Enabling actions](enable-actions.md)
* [Polling actions](polling-actions.md)
* [Set callbacks on actions](set-callbacks-on-actions.md)
* [Read devices directly](read-devices-directly.md)
* [Scripting with actions API overview](api-overview.md)
* [The Player Input component](player-input-component.md)
* [About the Player Input Component](about-player-input-component.md)
* [Get started with the Player Input component](get-started-player-input-component.md)
* [Select a notification behavior](select-notification-behavior.md)
* [Configure Unity Events](configure-unity-events.md)
* [Device Assignments](device-assignments.md)
* [Debug Player Input Component](debug-player-input-component.md)
* [Use PlayerInput Component with UI](use-player-input-component-ui.md)
* [Local multiplayer scenarios](local-multiplayer-scenarios.md)
* [Set up PlayerInput Component for local multiplayer](set-up-player-input-component-local-multiplayer.md)
* [The Player Input Manager Component](player-input-manager-component.md)
* [Get started with the Player Input Manager component](get-started-player-input-mananger-component.md)
* [Configure the Player Input Manager](configure-player-input-manager-component.md)
* [Set up split-screen local multiplayer](set-up-split-screen-local-multiplayer.md)
* [User rebinding at runtime](user-rebinding-runtime.md)
* [Look up bindings](look-up-bindings.md)
* [Display bindings](display-bindings.md)
* [Rebind an action at runtime](rebind-action-runtime.md)
* [Save and load rebinds](save-load-rebinds.md)
* [Restore original bindings](restore-original-bindings.md)
* [Input settings](input-settings.md)
* [Create a settings asset](create-settings-asset.md)
* [Update Mode](update-mode.md)
* [Background behavior](background-behavior.md)
* [Compensate orientation](compensate-orientation.md)
* [Default value properties](default-value-properties.md)
* [Supported devices](supported-devices.md)
* [Platform-specific settings](platform-specific-settings.md)
* [Devices](devices.md)
* [Types of input devices](devices-overview.md)
* [Pointer devices](devices-pointers.md)
* [Pointer devices introduction](pointers-introduction.md)
* [Touch devices](devices-touch.md)
* [Touch devices introduction](touch-introduction.md)
* [Touch polling](touch-polling.md)
* [Simulate touches](simulate-touch-input.md)
* [Bind touch input to an action](bind-touch-input.md)
* [Mouse devices](devices-mouse.md)
* [Mouse devices introduction](mouse-introduction.md)
* [Query and control mouse devices in code](query-mouse-devices.md)
* [Pen devices](devices-pen.md)
* [Pen devices introduction](pen-introduction.md)
* [Query pen devices in code](query-pen-devices.md)
* [Keyboards](devices-keyboard.md)
* [Keyboard devices introduction](keyboards-introduction.md)
* [Query keyboard devices in code](query-keyboards.md)
* [Read text input](read-keyboard-text-input.md)
* [Joystick support](devices-joysticks.md)
* [Gamepads](devices-gamepads.md)
* [Gamepads introduction](gamepads-introduction.md)
* [PlayStation gamepads](gamepads-p.md)
* [Switch gamepads](gamepads-s.md)
* [Xbox gamepads](gamepads-xbox.md)
* [Query and control gamepads in code](query-gamepads.md)
* [Gamepad polling](gamepad-polling.md)
* [Gamepad haptics](gamepad-haptics.md)
* [Sensors](devices-sensors.md)
* [Introduction to sensors](sensors-introduction.md)
* [Query sensors in code](query-sensors.md)
* [Supported sensors reference](supported-sensors-reference.md)
* [Tracked Input Devices](TrackedInputDevices.md)
* [Human Interface Device specification](hid-specification.md)
* [Human Interface Device specification introduction](hid-specification-introduction.md)
* [Create a custom device layout](hid-create-custom-layout.md)
* [Use an existing input device to create a layout](hid-create-custom-layout-existing.md)
* [Use a custom class to create a layout](hid-create-custom-layout-class.md)
* [Supported devices reference](supported-devices-reference.md)
* [Devices (scripting)](devices-scripting.md)
* [Device descriptions](device-descriptions.md)
* [Device capabilities](device-capabilities.md)
* [Device matching](device-matching.md)
* [Device lifecycle](device-lifecycle.md)
* [Create a device](create-device.md)
* [Remove a device](remove-device.md)
* [Reset a device](reset-device.md)
* [Sync a device](sync-device.md)
* [Enable and disable devices](enable-disable-devices.md)
* [Device background and focus changes](device-background-focus-changes.md)
* [Devices and domain reloads](devices-domain-reloads.md)
* [Native devices](native-devices.md)
* [Device IDs](device-ids.md)
* [Device usages](device-usages.md)
* [Device commands](device-commands.md)
* [Send a command to a device](send-command-to-device.md)
* [Add a custom device command](add-custom-device-command.md)
* [Device states](device-states.md)
* [Monitor device state changes](monitor-device-state-changes.md)
* [Synthesize a device state change](synthesize-device-state-change.md)
* [Working with devices](working-with-devices.md)
* [Monitor devices](monitor-devices.md)
* [Manually add and remove devices](manually-add-remove-devices.md)
* [Custom devices](custom-devices.md)
* [Input events](input-events.md)
* [Types of events](types-of-events.md)
* [Listen to events](listen-to-events.md)
* [Read state events](read-state-events.md)
* [Create events](create-events.md)
* [Record events](record-events.md)
* [Event processing](event-processing.md)
* [Event merging](event-merging.md)
* [Create a custom device](create-custom-device.md)
* [Step 1 The state struct](step-1-state-struct.md)
* [Step 2 The Device class](step-2-device-class.md)
* [Step 3 The Update method](step-3-update-method.md)
* [Step 4 Device registration and creation](step-4-device-registration-creation.md)
* [Step 5 current and all (optional)](step-5-current-all-optional.md)
* [Step 6 Device Commands (Optional)](step-6-device-commands-optional.md)
* [Input for user interfaces](ui-input.md)
* [Supported UI systems](supported-ui-systems.md)
* [Understand UI system compatibility](understand-ui-compatibility.md)
* [Using UI Input Module for UI support](using-ui-input-module.md)
* [Introduction to the UI Input Module](introduction-ui-input-module.md)
* [Supported input types in the UI Input Module](supported-ui-input-types.md)
* [Pointer input UI support](supported-ui-input-types-pointer.md)
* [Navigation input UI support](supported-ui-input-types-navigation.md)
* [Tracked input UI support](supported-ui-input-types-tracked.md)
* [Access the UI Input Module](access-ui-input-module.md)
* [UI Input Module component reference](ui-input-module-reference.md)
* [Use IMGUI alongside the Input System package](use-imgui-alongside-input-system.md)
* [Configure UI Input Actions](configure-ui-input-action-map.md)
* [Default UI Action Map reference](ui-action-map-reference.md)
* [Handling input target ambiguity](handling-input-target-ambiguity.md)
* [Use a Virtual Mouse for UI cursor control](virtual-mouse-ui-cursor-control.md)
* [Introduction to Virtual Mouse for UI cursor control](introduction-virtual-mouse.md)
* [Configure a Virtual Mouse](configure-virtual-mouse-input.md)
* [Virtual Mouse component reference](virtual-mouse-component-reference.md)
* [Multiplayer UI input](multiplayer-ui-input.md)
* [Introduction to multiplayer UI input](introduction-multiplayer-ui-input.md)
* [Configure multiplayer UI input](configure-multiplayer-ui-input.md)
* [Create on-screen controls](on-screen-controls.md)
* [Introduction to on-screen controls](introduction-on-screen-controls.md)
* [Create an on-screen button control](create-on-screen-button-control.md)
* [Create an on-screen stick control](create-on-screen-stick-control.md)
* [Create a custom on-screen control](create-custom-on-screen-control.md)
* [Timing and latency](timing-and-latency.md)
* [Input events queue](timing-input-events-queue.md)
* [Select an input processing mode](timing-select-mode.md)
* [Optimize for dynamic update](timing-optimize-dynamic-update.md)
* [Optimize for fixed update](timing-optimize-fixed-update.md)
* [Avoid missed or duplicate events](timing-missed-duplicate-events.md)
* [Mixed timing scenarios](timing-mixed-scenarios.md)
* [Editor features](EditorFeatures.md)
* [Read input in Editor Windows](read-input-editor-windows.md)
* [Use mobile device input in the Editor (Unity Remote)](use-mobile-device-input-editor-unity-remote.md)
* [See and record input event flow](see-record-input-event-flow.md)
* [Debugging](debugging.md)
* [The input debugger window](the-input-debugger-window.md)
* [Debug a device](debug-device.md)
* [Debug an action](debug-action.md)
* [Debug users and PlayerInput](debug-users-playerinput.md)
* [Debug layouts](debug-layouts.md)
* [Trace actions](trace-actions.md)
* [Visualizers](visualizers.md)
* [Visualise input controls](visualise-input-controls.md)
* [Visualise actions](visualise-actions.md)
* [Device Simulation](device-simulation.md)
* [Testing](testing.md)
* [Set up test assemblies](set-up-test-assemblies.md)
* [Set up test fixtures](set-up-test-fixtures.md)
* [Write tests](write-tests.md)
* [Layouts](layouts.md)
* [About layouts](about-layouts.md)
* [Layout formats](layout-formats.md)
* [Add a layout from C#](add-layout-from-cs.md)
* [Add a layout from JSON](add-layout-from-json.md)
* [Add a layout using Layout Builder](add-layout-using-layout-builder.md)
* [Layout inheritance](layout-inheritance.md)
* [Control items](control-items.md)
* [Override layout definitions](override-layout-definitions.md)
* [Precompiled layouts](precompiled-layouts.md)
* [Create a precompiled layout](create-precompiled-layout.md)
* [User management](user-management.md)
* [About user management](about-user-management.md)
* [Create a user paired with an input device](create-user-paired-with-input-device.md)
* [Handle loss of a device](handle-loss-of-device.md)
* [Migrate from the old input system](migrate-from-old-input-system.md)
* [Enable the correct input system](enable-correct-input-system.md)
* [Corresponding old and new APIs](corresponding-old-new-api.md)
* [How do I...?](HowDoI.md)
* [Architecture](Architecture.md)
* [Contribute to the Input System source code](Contributing.md)
* [Known limitations](KnownLimitations.md)
@@ -0,0 +1,21 @@
---
uid: input-system-testing
---
# Testing
Write automated input tests that drive the Input System from code without physical devices.
The Input System includes support for automated input tests. Generated input in tests is treated the same as input from platform backends at runtime, so you can verify gameplay and UI logic without depending on connected hardware. Work through the topics below in order: configure your test assemblies, set up a test fixture, then write tests.
| **Topic** | **Description** |
| :--- | :--- |
| **[Set up test assemblies](set-up-test-assemblies.md)** | Configure your project so Input System test code is included in test builds. |
| **[Set up test fixtures](set-up-test-fixtures.md)** | Run each test against an isolated Input System instance using InputTestFixture. |
| **[Write tests](write-tests.md)** | Add devices and simulate input using the InputTestFixture API. |
## Additional resources
- [Actions](actions.md)
- [The Player Input component](player-input-component.md)
- [Layouts](layouts.md)
@@ -0,0 +1,35 @@
---
uid: input-system-tracked-input-devices
---
# Tracked Input Devices
Some input devices can provide information about their spatial position and orientation. It can then be used to pose other objects in your scene, or to interact with your scene.
## Tracked Pose Driver
Use the Tracked Pose Driver component to synchronize a __GameObject__'s transform with input data from a tracked device such as an XR headset, motion controller, or other devices that provide positional and rotational tracking. It allows creating immersive XR experiences by dynamically updating the __GameObject__’s position and rotation based on the real-world movement of the tracked device. The component works with Unity's Input System to gather position, rotation, and tracking state data, and it provides several customization options, such as updating specific transform properties, controlling update timing, and managing how invalid tracking data is handled.
| **Property** | **Description** |
|-------------|-----------|
|[`Tracking Type`](xref:UnityEngine.InputSystem.XR.TrackedPoseDriver)|Specify which transform properties (position, rotation, or both) to update based on the tracked data.|
|[`Update Type`](xref:UnityEngine.InputSystem.XR.TrackedPoseDriver)|Determine when updates to the transform occur within Unity's event loop, such as during rendering or gameplay.|
|[`Ignore Tracking State`](xref:UnityEngine.InputSystem.XR.TrackedPoseDriver)| Enable to ignore the tracking state and assume that the input pose is valid, even when flagged otherwise.|
|[`Position Input`](xref:UnityEngine.InputSystem.XR.TrackedPoseDriver)|Set an input action that retrieves the position data (Vector3) of the tracked device.|
|[`Rotation Input`](xref:UnityEngine.InputSystem.XR.TrackedPoseDriver)| Set an input action that retrieves the rotation data (Quaternion) of the tracked device.|
|[`Tracking State Input`](xref:UnityEngine.InputSystem.XR.TrackedPoseDriver)|Set an input action that determines whether the tracking state (position or rotation) is valid (integer).|
## Tracked Device Raycaster
Use the Tracked Device Raycaster component to enable ray casting from tracked input devices, such as XR controllers, to interact with UI elements rendered in 3D space.
Tracked Device Raycaster works with the the __Canvas__ component, and replaces the standard __GraphicRaycaster__ for XR and AR use cases. Use Tracked Device Raycaster to process pointer events that are based on ray intersections with graphics in world space.
The component also supports occlusion checks, custom ray distance limits, and filtering of reversed graphics to enable UI interactions in immersive environments. You can use it to build XR-enabled user interfaces where traditional 2D input methods, such as a mouse, do not apply.
| **Property** | **Description** |
|-------------|-----------|
|[`Ignore Reversed Graphics`](xref:UnityEngine.InputSystem.UI.TrackedDeviceRaycaster)| Enable to ignore graphics whose normal faces away from the direction of the ray.|
|[`Check For 2D Occlusion`](xref:UnityEngine.InputSystem.UI.TrackedDeviceRaycaster)|Enable occlusion checks for 2D objects, such as sprites in the scene.|
|[`Check For 3D Occulusion`](xref:UnityEngine.InputSystem.UI.TrackedDeviceRaycaster)|Enable occlusion checks for 3D objects to prevent rays from passing through physical geometry.|
|[`Max Distance`](xref:UnityEngine.InputSystem.UI.TrackedDeviceRaycaster)|Set the maximum ray distance for interaction detection in world space coordinates.|
|[`Blocking Mask`](xref:UnityEngine.InputSystem.UI.TrackedDeviceRaycaster)|Define the layer mask used to check for occlusion when ray casting.|
@@ -0,0 +1,24 @@
---
uid: input-system-workflows
---
# Input System Workflows
There are multiple ways to use the Input System, however the primary and recommended workflow is to use the **Input Actions** panel in the **Project Settings window** to configure your project-wide actions and bindings, get references to those Actions in your code's Start method, then read the values for those actions in your Update method.
There are other workflows which can suit more unusual situations, for example you can use the **PlayerInput component** together with actions and bindings which adds a further layer of abstraction, allowing you to connect actions to your event handlers without requiring any intermediate code, and easily handle multiplayer scenarios.
You can choose to configure actions and bindings in the Editor UI, or you can set up everything through scripting. Or you can take a more direct approach by omitting the actions and bindings features altogether and instead use script to directly read the state of devices.
The descriptions below describe these main workflows and link to more detailed description of them.
|Workflows | Description |
|---|---|
|[**Using Actions**](using-actions-workflow.md)|This is the **recommended** workflow for most situations. In this workflow, you use the [Actions Editor window](actions-editor.md) to configure sets of actions and bindings, then set up references and read the values for those actions in your code.|
|[**Using Actions and the PlayerInput Component**](using-playerinput-workflow.md)|This workflow provides extra features that allow you to connect up **callbacks** directly from Actions to your own callback handler methods, removing the need to deal with Action references in your code. It also provides features that are useful in **local multiplayer** scenarios such as device assignment and split-screen functionality.|
|[**Directly read device states**](using-direct-workflow.md)|This workflow is a simplified, script-only approach which bypasses the actions and bindings features entirely. Instead your script explicitly references specific device controls (such as "left gamepad stick") and reads the values directly. This is suitable for **fast prototyping**, or single fixed platform scenarios. It is a **less flexible** workflow because it bypasses some of the main input system features.|
> [!NOTE]
> Because the Input System has multiple workflows, the code samples used throughout this documentation also vary, often demonstrating techniques using various workflows. For example, some code samples may use Action references, and some may use the workflow of reading input directly from devices.
@@ -0,0 +1,15 @@
---
uid: input-system-about-action-assets
---
# About action assets
The Input System stores your configuration of [Input Actions](actions.md) and their associated [bindings](bindings.md), [action maps](create-edit-delete-action-maps.md) and [Control Schemes](control-schemes.md) in an [action asset](action-assets.md) file. These Assets have the `.inputactions` file extension and are stored in a plain JSON format.
## Project-wide action assets
The Input System creates an action asset when you set up the [default project-wide actions](about-project-wide-actions.md), which is the most common and recommended workflow, but you can also [create new empty action assets](./create-empty-action-asset.md) directly in the Project window.
## Action maps
Actions assets allow you to group sets of related actions into [action maps](./create-edit-delete-action-maps.md). For example, in an open-world city game, you might create separate action maps for different situations such as exploring on foot, driving a car, flying an aircraft, or navigating UI interfaces. This means, for most common scenarios, you don't need to use more than one Input action asset.
@@ -0,0 +1,25 @@
---
uid: input-system-about-action-control-types
---
# About action and control types
Each action has an **action type** and a **control type**. These settings are displayed in the [Action Properties panel](./action-properties-panel-reference.md) when you select an action in the [Actions Editor window](./actions-editor.md).
![The Action Properties panel of the Input Actions Editor displays the Action, Interactions, and Processors groups expanded.](Images/ActionProperties.png)
When you configure an action, you can select an action type and control type that best represents what your action is for, and how you want it to be activated by the [controls](./controls.md) it is [bound](./bindings.md) to.
## Action type
The **action type** influences how the Input System processes state changes for the action, and relates to whether this action represents a discrete on/off button-style interaction or a value that can change gradually over time.
## Control type
The **control type** determines the type of value that should be sent to the action, such as an in integer or float value, or a 1D, 2D, or 3D axis.
The control type that you select has the effect of filtering the available controls to only those that are capable of providing the values appropriate for that control.
For example, if you select **2D axis** as the control type, only those types of controls that can supply a 2D vector as value are available as options for the binding control path, such as a thumb stick or Dpad.
There are more specific control types available which further filter the available bindings, such as **Stick**, **Dpad** or **Touch**. If you select one of these control types, the list of available controls is further limited to only those controls of those specific types when you [select a binding for your action](add-duplicate-delete-binding.md).
@@ -0,0 +1,25 @@
---
uid: input-system-about-layouts
---
# About layouts
Layouts are the central mechanism by which the Input System learns about types of Input Devices and Input Controls. Each layout represents a specific composition of Input Controls. By matching the description of a Device to a layout, the Input System is able to create the correct type of Device and interpret the incoming input data correctly.
> [!NOTE]
> Layouts are an advanced, mostly internal feature of the Input System. Knowledge of the layout system is mostly useful if you want to support custom Devices or change the behavior of existing Devices.
A layout describes a memory format for input, and the Input Controls to build in order to read and write data to or from that memory.
The Input System ships with a large set of layouts for common Control types and common Devices. For other Device types, the system automatically generates layouts based on the Device description that the Device's interface reports.
Open the Input Debugger to browse the set of currently available layouts. A layout has two primary functions:
* Describe a certain memory layout containing input data.
* Assign names, structure, and meaning to the Controls operating on the data.
A layout can either be for a Control on a Device (for example, `Stick`), or for a Device itself (that is, anything based on [`InputDevice`](xref:UnityEngine.InputSystem.InputDevice)).
The Input System only loads layouts when they are needed (usually, when creating a new Device). To manually load a layout, you can use [`InputSystem.LoadLayout`](xref:UnityEngine.InputSystem.InputSystem). This returns an [`InputControlLayout`](xref:UnityEngine.InputSystem.Layouts.InputControlLayout) instance, which contains the final, fully merged (that is, containing any information inherited from base layouts and/or affected by layout overrides) structure of the layout.
You can register new layouts through [`InputSystem.RegisterLayout`](xref:UnityEngine.InputSystem.InputSystem).
@@ -0,0 +1,18 @@
---
uid: input-system-about-player-input-component
---
# About the Player Input component
![PlayerInput](Images/PlayerInput.png)<br/>
*Above, the Player Input component displayed in the inspector.*
## Connecting actions to methods or callbacks
The **Player Input** component represents a single player, and the connection between that player's associated device, Actions, and methods or callbacks.
You can use a single instance of a Player Input component in a single-player game to set up a mapping between your Input Actions and methods or callbacks in the script that controls your player.
For example, by using the Player Input component, you can set up a mapping between actions such as "Jump" to C# methods in your script such as `public void OnJump()`.
There are a few options for doing exactly how the Player Input component does this, such as using SendMessage, or Unity Events, which is described in more detail below.
@@ -0,0 +1,31 @@
---
uid: input-system-project-wide-actions
---
# About project-wide actions
You can assign an individual action asset to be available "project-wide", which means the actions within that asset are available more conveniently through the Input System API without needing to set up references to the asset.
When you [assign an action asset as project-wide](assign-project-wide-actions.md), it also becomes automatically [preloaded](https://docs.unity3d.com/ScriptReference/PlayerSettings.GetPreloadedAssets.html) when your app starts up, and is kept available until it terminates.
Unless you have specific project requirements that require more than one action asset, the recommended workflow is to use a single action asset assigned as the project-wide actions.
## Edit project-wide actions
Once you have created and assigned project-wide actions, the Input System Package page in Project Settings displays the **Actions Editor** interface. Read more about how to use the [Actions Editor](actions-editor.md) to configure your actions.
![image alt text](./Images/ProjectSettingsInputActionsSimpleShot.png)
*The Input System Package Project Settings after creating and assigning the default actions*
## Using project-wide actions in code
The benefit of assign an action asset as the project-wide actions is that you can access the actions directly through the [`InputSystem.actions`](xref:UnityEngine.InputSystem.InputSystem) property directly, rather than needing to set up a reference to your action asset first.
For example, you can get a reference to an action named "Move" in your project-wide actions using a line of code like this:
```
InputSystem.actions.FindAction("Move");
```
Project-wide actions are also enabled by default.
@@ -0,0 +1,38 @@
---
uid: input-system-about-respond-input
---
# About responding to input
The Input System offers various ways to respond to input at runtime, from the recommended workflow using [actions](actions.md) and [bindings](bindings.md), to more direct techniques such as reading device controls directly.
## Recommended workflow
Working with the Input System's [recommended workflow](Workflows.md) in your project involves two phases which you must approach in this order:
1. Configure your project's actions.
2. Implement responses to actions.
### Configure your project's actions
You must first [configure input for your project](setting-up-input.md) as [actions](actions.md), before you can respond to those actions.
In some situations you might find the configuration in the [default project-wide actions](default-actions.md) covers all your needs, and you can go straight to implementing responses to input. In other cases you might want to start with the default configuration and [add or modify actions](configure-actions.md), or you can [start with an empty configuration and define your own](create-empty-action-asset.md).
### Implement responses to actions
Once you have your actions set up, you can implement responses to those actions.
There are two main techniques you can use to respond to actions in your project. These are to either use **polling** or an **event-driven** approach.
- The **polling** approach refers to the technique of repeatedly checking the current state of your actions. Typically you do this in the `Update()` method of a `MonoBehaviour` script. Refer to [polling actions](polling-actions.md) for further information.
- The **event-driven** approach involves creating your own methods in code that are automatically called when an action is performed. Refer to [Set callbacks on actions](set-callbacks-on-actions.md) for further information.
For most common scenarios, especially action games where the user's input has a continuous centralized effect on an in-game character, **polling** is usually simpler and easier to implement. For other situations where input is less continuous, or directed to many different areas in your scene, an event-driven approach might be more appropriate.
## Other workflows
The Input System also allows you to read device states directly, which bypasses many of the features such as actions and bindings. This workflow is suitable for fast prototyping, or single fixed platform scenarios, but is a less flexible workflow because it bypasses some useful Input System features.
Refer to [Read devices directly](read-devices-directly.md) for further information about this workflow.
@@ -0,0 +1,17 @@
---
uid: input-system-user-management-about
---
# About user management
The Input System supports multi-user management through the [`InputUser`](xref:UnityEngine.InputSystem.Users.InputUser) class. This comprises both user account management features on platforms that have these capabilities built into them (such as Xbox and PS4), as well as features to manage Device allocations to one or more local users.
> [!NOTE]
> The user management API is quite low-level in nature. The stock functionality of Player Input Manager component (refer to [Player Input Manager](player-input-manager-component.md)) provides an easier way to set up user management. The API described here is useful when you want more control over user management.
In the Input System, each [`InputUser`](xref:UnityEngine.InputSystem.Users.InputUser) represents a human interacting with the application. For example, you can have multiple users playing a game together on a single computer or device (local multiplayer), where each user has one or more [paired Input Devices](create-user-paired-with-input-device.md).
The [`PlayerInputManager`](player-input-manager-component.md) class uses [`InputUser`](xref:UnityEngine.InputSystem.Users.InputUser) internally to handle users.
> [!NOTE]
> In the editor, all `InputUser` instances are automatically removed when exiting play mode thus also removing any device pairings. In essence, `InputUser` is considered a player-only API.
@@ -0,0 +1,17 @@
---
uid: input-system-access-ui-component
---
# Access the UI Input Module component
The UI Input Module is a component that passes input actions from the Input System to the UI in your scene.
You must add the UI Input Module to a GameObject in your scene, so that the UI can receive input from the Input System. To do this:
1. Create a new empty GameObject
2. Click [**Add Component**](https://docs.unity3d.com/Manual/UsingComponents.html) in the Inspector
3. In the search field displayed, type `input system ui`.
4. Select **Input System UI Input Module** to add it to the GameObject.
![The Add Component search bar displays 'input system ui' to highlight the 'Input System UI Input Module' component.](Images/InputSystemUIInputModuleAdd.png)
@@ -0,0 +1,21 @@
---
uid: input-system-action-control-types
---
# Action and control types
Actions have an **Action Type** and **Control Type** which you can configure in the [Actions Editor window](actions-editor.md). These settings allow you to configure the basic behaviour of an action.
| **Topic** | **Description** |
| :--- | :--- |
| **[About action and control types](about-action-control-types.md)** | Learn about what action types and control types are, and the effects that the different settings can have. |
| **[Configure action type](configure-action-type.md)** | Configure the action's Action Type, which relates to whether an action represents a discrete on/off button-style interaction or a value that can change gradually over time. |
| **[Action type reference](action-type-reference.md)** | Information about each of the available action type options. |
| **[Configure control type](configure-control-type.md)** | Select the type of control expected by the action. |
## Additional resources
- [Control types reference](control-types-reference.md)
- [Actions](actions.md)
- [Bindings](bindings.md)
- [Input Actions Editor references](actions-editor.md)

Some files were not shown because too many files have changed in this diff Show More