input-simulation
Skill15 starsChanged 5 months agoMITView on GitHub
Skill for AI agents testing a game in the Unity Editor by simulating input — clicks, drags, swipes, key presses, and touches — through the unity-open-mcp MCP server. This domain is embedded in the bridge and opt-in. Its tool group is hidden from ListTools until the connected session activates it. The uGUI tools (pointer, step, probe, pointer3d) compile when com.unity.ugui is present; the keyboard/touch tools compile when com.unity.inputsystem is present. Call capabilities to see which half is live. - Unity…
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- demo/AGENTS.mdAGENTS.md
- hub/AGENTS.mdAGENTS.md
- mcp-server/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- skills/AGENTS.mdAGENTS.md
- animationSkill
- audioSkill
- cinemachineSkill
- constraintsSkill
- inputsystemSkill
- lightingSkill
- memoryprofilerSkill
- navigationSkill
- particlesystemSkill
- probuilderSkill
- shadergraphSkill
- splinesSkill
- spriteatlasSkill
- terrainSkill
- textureSkill
- tilemapSkill
- timelineSkill
- uiSkill
- vfxSkill
- unity-open-mcpSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
All six are gate-free (IsMutating=false — input writes no assets).
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Unity Open MCP — Input Simulation Extension
Skill for AI agents testing a game in the Unity Editor by simulating input —
clicks, drags, swipes, key presses, and touches — through the unity-open-mcp
MCP server.
This domain is embedded in the bridge and opt-in. Its tool group is hidden from
ListToolsuntil the connected session activates it. The uGUI tools (pointer,step,probe,pointer3d) compile whencom.unity.uguiis present; the keyboard/touch tools compile whencom.unity.inputsystemis present. Callcapabilitiesto see which half is live.
Preconditions
- Unity Editor is open with the target project.
unity_open_mcp_pingreturnsconnected: true.- The
input-simulationtool group is activated:unity_open_mcp_manage_tools(action: "activate", group: "input-simulation"). Or use intent activation:unity_open_mcp_manage_tools(action: "activate_for", intent: "click and drag UI to test the game"). - Most tools need play mode (
pointer,key,touch,step,pointer3d). Enter it first:unity_open_mcp_editor_set_state(state: "play").probeis read-only and works in edit mode too — use it to build a click plan before entering play mode.
Tools
| Tool | Reach | Play mode? |
inputsim_pointer | uGUI (EventSystem + ExecuteEvents) — click/drag/hover/submit on a named GameObject, object_id, or screen point | yes |
inputsim_pointer3d | 3D / legacy — Physics.Raycast + OnMouseDown/OnMouseUp/OnMouseDrag SendMessage | yes |
inputsim_key | Input System keyboard device events (Keyboard.current) | yes |
inputsim_touch | Input System touch / swipe (Touchscreen.current) | yes |
inputsim_step | Advance N play-mode frames (EditorApplication.Step) | yes |
inputsim_probe | List active uGUI interactables (paths, ids, rects, interactable, occluded) | no (works in edit mode) |
All six are gate-free (IsMutating=false — input writes no assets).
Which tool reaches which code
Unity has four input surfaces. Pick the tool that reaches the code your game
actually reads — callback vs polling matters for key/touch:
| The game reads… | Use | Polling? |
uGUI handlers (Button.onClick, IPointerClickHandler, IDragHandler, IDropHandler) | inputsim_pointer | n/a (event-driven) |
OnMouseDown / physics-raycast gameplay (legacy Input Manager) | inputsim_pointer3d | n/a (event-driven) |
InputAction.performed += … (callback) | inputsim_key / inputsim_touch | callback — fires without advance_frames |
Keyboard.current[K].wasPressedThisFrame (polling) | inputsim_key with advance_frames ≥ 1 | polling — needs frame advance |
Touchscreen.current / per-frame primaryTouch.delta (polling) | inputsim_touch with advance_frames ≥ 1 | polling — needs frame advance |
Legacy UnityEngine.Input.GetKeyDown | not covered — use invoke_method / execute_csharp, or inputsim_pointer3d for OnMouseDown physics gameplay |
Why polling needs advance_frames: a synchronous tool call processes down+up
in a single InputSystem.Update() — no MonoBehaviour.Update ticks in between,
so wasPressedThisFrame is already false by the time game code next runs. Pass
advance_frames: 1 (or more) to pump that many player-loop frames between down
and up. An input update inside each stepped frame consumes the press so gameplay
can observe wasPressedThisFrame. Splitting down → inputsim_step → up
works for held-state polling; the immediate down update may consume the edge.
The self-sufficient testing loop
probe (edit mode OK) → click by object_id → step → screenshot- Discover —
inputsim_probelists every active interactable with itsinstanceId,interactableflag, and whether it isoccluded. No guessing names. Works before entering play mode. - Enter play mode —
editor_set_state(state: "play"). - Interact —
inputsim_pointer(object_idfrom probe is unambiguous),inputsim_key/inputsim_touch(withadvance_framesfor polling code), orinputsim_pointer3dfor world-space gameplay. - Advance —
inputsim_step(frames: N)so tweens, animations, and polling code run before you look. This is mandatory between an interaction and a screenshot — without it a click that opens a panel with a 0.3s tween screenshots as the old panel. - Verify —
screenshot(view: "game"),visual_compare(regression), orread_consolefor gameplay logs/errors.
Recipe: probe → click → step → screenshot
// 1. Discover (edit mode or play mode).
{ } // inputsim_probe
// → { "interactables":[{ "path":"Canvas/MainMenu/StartButton",
// "instanceId":-10234, "interactable":true, "occluded":false, ... }], ... }
// 2. Enter play mode + click by instanceId (unambiguous).
{ "state": "play" } // editor_set_state
{ "action": "click", "object_id": "-10234" } // inputsim_pointer (probe's instanceId; pass as a string, bare number also accepted)
// → { "status":"ok", "target":"Canvas/MainMenu/StartButton",
// "interactable":true, "blockedBy":null,
// "dispatched":["pointerDown","pointerUp","pointerClick"] }
// 3. Advance frames so the panel-open tween settles, then look.
{ "frames": 10 } // inputsim_step
{ "view": "game" } // screenshotRecipe: drag an item onto a slot (IDropHandler)
{ "action": "drag", "from_target": "Inventory/Sword", "to_target": "Hotbar/Slot3", "drag_steps": 12 }
// inputsim_pointer — fires beginDrag → drag×N → pointerUp → drop(on Slot3) → endDrag.
// Response carries dropTarget + dropLanded so you know the item reached the slot.Recipe: hold a key for polling gameplay (Input System)
// Polling wasPressedThisFrame needs a frame advance while the key is down.
{ "action": "tap", "key": "Space", "advance_frames": 3 } // inputsim_key
// or split it:
{ "action": "down", "key": "Space" } // inputsim_key
{ "frames": 5 } // inputsim_step
{ "action": "up", "key": "Space" } // inputsim_key (releases Space only)Recipe: click a 3D world object (legacy Input Manager)
{ "action": "click", "screen_x": 540, "screen_y": 960 } // inputsim_pointer3d
// Physics.Raycast → OnMouseDown + OnMouseUpAsButton + OnMouseUp on the hit collider.Response contract — honesty fields
inputsim_pointer returns:
{ "status": "ok",
"target": "Canvas/MainMenu/StartButton",
"screenPoint": [540.0, 960.0],
"hasHandler": true,
"interactable": true,
"blockedBy": null,
"eventSystem": true,
"dispatched": ["pointerDown", "pointerUp", "pointerClick"] }interactable: false— the target (or an ancestorCanvasGroup) is disabled. The dispatch still ran but a real player click would have no-op'd. Re-check game state before reporting the feature works.blockedBy: "<path>"— something else raycast-hits in front of the target's center (a modal, a loading overlay, a popup). The target-path dispatch still fired (occlusion-skipping is a feature for reaching hidden objects), but a real click would have hit the blocker. This is a trade, not a pure advantage: reaching hidden objects also means never noticing that a modal is blocking the UI.hasHandler: false— noIPointer*Handleron the target or ancestors; the dispatched events no-op'd.dropTarget/dropLanded(drag only) — where the drop actually landed.dropLanded: falsemeans nothing receivedIDropHandler(dragged to empty space, or the slot has noIDropHandler).
inputsim_step returns { framesAdvanced, initialPaused, steppedPaused, pausedRestored }.
Error codes
| Code | Meaning | Fix |
play_mode_required | Called outside play mode | editor_set_state(state: "play") first |
no_event_system | No EventSystem in the scene (pointer) | Add one (create via ui_canvas_add, or add an EventSystem GameObject) |
target_not_found | target matches no active GameObject | Check the name/path; only active objects are searched |
ambiguous_target | target matches >1 active GameObject (inputsim_pointer, inputsim_pointer3d, inputsim_touch) | Use the full path, a longer trailing segment, or object_id (candidates listed). inputsim_key takes no target |
no_hit | Screen point raycast hit nothing | Check the point is over a raycast-target element |
both_endpoint_forms | Both target and screen coords supplied for one drag endpoint | Pass one form per endpoint (target wins; this error makes it explicit) |
no_target_or_screen_point | Neither object_id, target, nor screen point given | Provide one |
no_camera | Camera.main is null (pointer3d) | Tag a MainCamera in the scene |
no_device | Keyboard.current / Touchscreen.current is null | Set Active Input Handling to Input System; for touch on desktop, prefer inputsim_pointer |
invalid_key / invalid_action | Bad enum value | See the tool's enum |
Limits
- Ambiguity detection covers every tool that takes a
target.inputsim_pointer,inputsim_pointer3d, andinputsim_touchall walk active transforms and returnambiguous_target(with candidate paths) when a name/path matches more than one GameObject — none silently returns an arbitrary first match. (inputsim_pointershares the uGUI half'sPointerTargets;inputsim_touchcarries its own self-contained resolver so its sub-asmdef stays independent.)inputsim_keytakes no target. When a name is shared, prefer a unique path or anobject_idfrominputsim_probefor pointer tools. Touch accepts unique paths or screen coordinates, notobject_id. - uGUI drag is single-frame.
begin/drag×N/pointerUp/drop/endDragdispatch in one frame. Useinputsim_stepafterward to let drag-driven tweens settle. holdduration is the number of advanced frames, not wall-clock. Pairholdwithadvance_framesfor held-state polling. Hold interactions still require actual elapsed input time;duration_msdoes not wait.upreleases the named key and explicitly requested modifiers. Other held keys survive. Use matching modifier flags to release modifiers.- Touch multi-touch beyond finger 0 is best-effort. Single-finger tap/swipe is the verified path.
- Probe occlusion is reported only in play mode (needs a live EventSystem
raycast); in edit mode
occludedis false (unknown), not a hard failure.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

