You can use the Input System package to control any in-game UI created with the Unity UI package. The integration between the Input System and the UI system is handled by the
NOTE: The Input System package does not currently support IMGUI or UIElements. This is in development.
InputSystemUIInputModule component acts as a drop-in replacement for the
StandaloneInputModule component that the Unity UI package.
InputSystemUIInputModule provides the same functionality as
StandaloneInputModule, but it uses the Input System instead of the legacy Input Manager to drive UI input.
If you have a
StandaloneInputModule component on a GameObject, and the Input System is installed, Unity shows a button in the Inspector offering to automatically replace it with a
InputSystemUIInputModule for you. The
InputSystemUIInputModule is pre-configured to use default Input Actions to drive the UI, but you can override that configuration to suit your needs.
You can use the following properties to configure
||The initial delay (in seconds) between generating an initial navigation event and generating repeated navigation events when the Move Action stays actuated.|
||The interval (in seconds) between generating repeat navigation events when the Move Action stays actuated.|
By default, this references a built-in Asset named DefaultInputActions, which contains common default Actions for driving UI. If you want to set up your own Actions, create a custom Input Action Asset and assign it here. When you assign a new Asset reference to this field in the Inspector, the Editor attempts to automatically map Actions to UI inputs based on common naming conventions.
||By default, when the pointer is clicked and does not hit any
You can use the following properties to map Actions from the chosen Actions Asset to UI input Actions. In the Inspector, these appear as foldout lists that contain all the Actions in the Asset:
||An Action that delivers a 2D screen position. Use as a cursor for pointing at UI elements to implement mouse-style UI interactions.|
||An Action that maps to the primary cursor button used to interact with UI.|
||An Action that maps to the middle cursor button used to interact with UI.|
||An Action that maps to the secondary cursor button used to interact with UI.|
||An Action that delivers gesture input to allow scrolling in the UI.|
||An Action that delivers a 2D vector used to select the currently active UI selectable. This allows a gamepad or arrow-key style navigation of the UI.|
||An Action to engage with or "click" the currently selected UI selectable.|
||An Action to exit any interaction with the currently selected UI selectable.|
||An Action that delivers a 3D position of one or multiple spatial tracking devices, such as XR hand controllers. In combination with
||An Action that delivers a quaternion representing the rotation of one or multiple spatial tracking devices, such as XR hand controllers. In combination with
||An Action to submit "clicks" on UI selectables coming from a spatial tracking device. For example, you can map this to the trigger button on an XR controller to allows XR-style UI interactions in combination with
The Input System can also handle multiple separate UI instances on the screen controlled separately from different input Bindings. This is useful if you want to have multiple local players share a single screen with different controllers, so that every player can control their own UI instance. To allow this, you need to replace the
EventSystem component from Unity with the Input System's
EventSystem component, you can have multiple
MultiplayerEventSystems active in the Scene at the same time. That way, you can have multiple players, each with their own
MultiplayerEventSystem components, and each player can have their own set of Actions driving their own UI instance. If you are using the
PlayerInput component, you can also set up
PlayerInput to automatically configure the player's
InputSystemUIInputModule to use the player's Actions. See the documentation on
PlayerInput to learn how.
The properties of the
MultiplayerEventSystem component are identical with those from the Event System. Additionally, the
MultiplayerEventSystem component adds a
playerRoot property, which you can set to a GameObject that contains all the UI selectables this event system should handle in its hierarchy. Mouse input that this event system processes then ignores any UI selectables which are not on any GameObject in the Hierarchy under