Steam Input
Steam Input lets players use any controller Steam supports, such as Xbox, PlayStation, Switch Pro and Steam Deck controllers, and rebind them in Steam. Your game reads actions, such as "Jump" or "Move", instead of specific buttons.
The Steam Input nodes are called on Get Steam Input.
Prerequisites
- Your own Steam App ID, see Using Your Own App ID.
- Steam is running and the game is launched as a Standalone Game or a packaged build.
Step 1: Create an Action Manifest
The action manifest is a VDF file that lists your action sets (for example InGameControls and MenuControls) and the actions in each set. Valve describes the format in the Steam Input documentation.
During development, call Set Input Action Manifest File Path with the absolute path to the file after Init. For release, configure Steam Input on the Steamworks partner site under Application → Steam Input and publish default configurations for the controllers you support.
Step 2: Initialize Steam Input
- Call Init once, for example in your Game Instance.
- Call Get Connected Controllers to get an Input Handle for each controller.
- Bind On Steam Input Device Connected Callback and On Steam Input Device Disconnected Callback to update your list when controllers are added or removed.
Step 3: Activate an Action Set
- Call Get Action Set Handle with the action set name, for example
InGameControls. - Call Activate Action Set with the controller's Input Handle and the action set handle.
Switch to another action set when the context changes, for example from gameplay to a menu.
Step 4: Read Actions
Get the action handles once and store them:
- Get Digital Action Handle for buttons, for example
Jump. - Get Analog Action Handle for sticks and triggers, for example
Move.
Then read the actions every frame, for example on Event Tick:
- Get Digital Action Data returns bState (pressed or not) and bActive.
- Get Analog Action Data returns X and Y.
Instead of polling digital actions, you can call Enable Action Event Callbacks and bind On Steam Input Action Event Callback.
Showing Button Glyphs
To show the correct button icon for an action:
- Call Get Digital Action Origins with the controller, action set and action handle.
- Pass an origin to Get Glyph PNG for Action Origin. It returns the path to an image file.
- Load the image with Unreal's Import File as Texture 2D node and show it in your UI.
Get String for Action Origin returns a readable name, such as "A Button".
Other Useful Nodes
| Node | Description |
|---|---|
| Show Binding Panel | Opens the Steam overlay where the player can change the controller bindings. |
| Trigger Vibration | Rumble on the controller. |
| Set LED Color | Changes the light bar color on supported controllers. |
| Get Motion Data | Gyro and accelerometer data. |
| Activate Action Set Layer | Adds a layer on top of the active action set, for example while aiming. |