This skill helps an agent read player input in Unity through the Input System package, which replaces the legacy Input class. It checks the Active Input Handling value in the project file, reuses the project-wide actions asset, and edits an .inputactions file as JSON when the Editor is closed.
It includes patterns for polling actions, callbacks with action map switching and PlayerInput messages, a test using InputTestFixture, and a reference on interactive rebinding, saving overrides and local multiplayer. A gotchas list covers no input, FindAction returning null and menus that receive gameplay input.
What You Get
- A six-step workflow from reading the input handler setting to choosing how code reads actions
- Three C# patterns: polled project-wide actions, callbacks with map switching and PlayerInput Send Messages
- A verification list that checks action names against the JSON file and a test example using virtual devices
- A reference on press-a-key rebinding, saving binding overrides and PlayerInputManager co-op
Common Use Cases
- Finding why input does nothing after switching to the Input System
- Fixing FindAction returning null because a name or map path is wrong
- Stopping gameplay actions from firing while a menu is open
- Porting Input.GetAxis code to action-based input
What Makes It Unique
The skill reads Unity’s settings and assets as files: it checks the input handler value in the project settings and edits the .inputactions JSON, with fresh IDs, when the Editor is closed. It also names version-specific behavior such as project-wide actions enabling every map at startup, which explains menus receiving gameplay input.
Under The Hood
The agent loads the SKILL.md and, for rebinding or local co-op, one reference file. It reads project settings, package files and the .inputactions JSON, searches scripts for legacy Input calls and edits C# and JSON files. When the Unity command line tool and a running game are available it can inject a key press and read the effect back with an evaluate command; that tool is a pre-release package. Tests run through Unity’s test runner. The rebinding example stores overrides with player preferences. Nothing is fetched from the web during normal use.