Input configuration in code
Create, load, and configure actions and bindings in scripts instead of in the Input Actions Editor window.
You can set up actions, bindings, and related settings in the Input Actions Editor window or in code. Use the pages in this section when you want full control in your scripts, need to generate or load definitions at runtime, or don't want to use an input action asset.
| Topic | Description |
|---|---|
| Declare standalone actions | Expose InputAction and InputActionMap fields on a MonoBehaviour and configure them in the Inspector window or in code. |
| Configure input from JSON | Create or load InputActionMap and InputActionAsset instances from JSON strings at edit time or runtime. |
| Create actions in code | Create and configure actions entirely in code. |
| Bindings in code | Work with InputBinding in code: add, change, or erase bindings, and set up composites, parameters, overrides, and control schemes. |
For a high-level map of the actions API (enabling, polling, callbacks), refer to Scripting with actions API overview.