agentleFS
AlexeyPerovAlexeyPerov/Unity-Open-MCP/skills/extensions/input-simulation/SKILL.md

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…

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
  1. Very specific:

    All six are gate-free (IsMutating=false — input writes no assets).

    line 37

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 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.

Preconditions

  • Unity Editor is open with the target project.
  • unity_open_mcp_ping returns connected: true.
  • The input-simulation tool 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"). probe is read-only and works in edit mode too — use it to build a click plan before entering play mode.

Tools

ToolReachPlay mode?
inputsim_pointeruGUI (EventSystem + ExecuteEvents) — click/drag/hover/submit on a named GameObject, object_id, or screen pointyes
inputsim_pointer3d3D / legacy — Physics.Raycast + OnMouseDown/OnMouseUp/OnMouseDrag SendMessageyes
inputsim_keyInput System keyboard device events (Keyboard.current)yes
inputsim_touchInput System touch / swipe (Touchscreen.current)yes
inputsim_stepAdvance N play-mode frames (EditorApplication.Step)yes
inputsim_probeList 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…UsePolling?
uGUI handlers (Button.onClick, IPointerClickHandler, IDragHandler, IDropHandler)inputsim_pointern/a (event-driven)
OnMouseDown / physics-raycast gameplay (legacy Input Manager)inputsim_pointer3dn/a (event-driven)
InputAction.performed += … (callback)inputsim_key / inputsim_touchcallback — fires without advance_frames
Keyboard.current[K].wasPressedThisFrame (polling)inputsim_key with advance_frames ≥ 1polling — needs frame advance
Touchscreen.current / per-frame primaryTouch.delta (polling)inputsim_touch with advance_frames ≥ 1polling — needs frame advance
Legacy UnityEngine.Input.GetKeyDownnot 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
  1. Discover — inputsim_probe lists every active interactable with its instanceId, interactable flag, and whether it is occluded. No guessing names. Works before entering play mode.
  2. Enter play mode — editor_set_state(state: "play").
  3. Interact — inputsim_pointer (object_id from probe is unambiguous), inputsim_key / inputsim_touch (with advance_frames for polling code), or inputsim_pointer3d for world-space gameplay.
  4. 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.
  5. Verify — screenshot (view: "game"), visual_compare (regression), or read_console for 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" }                                           // screenshot

Recipe: 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 ancestor CanvasGroup) 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 — no IPointer*Handler on the target or ancestors; the dispatched events no-op'd.
  • dropTarget / dropLanded (drag only) — where the drop actually landed. dropLanded: false means nothing received IDropHandler (dragged to empty space, or the slot has no IDropHandler).

inputsim_step returns { framesAdvanced, initialPaused, steppedPaused, pausedRestored }.

Error codes

CodeMeaningFix
play_mode_requiredCalled outside play modeeditor_set_state(state: "play") first
no_event_systemNo EventSystem in the scene (pointer)Add one (create via ui_canvas_add, or add an EventSystem GameObject)
target_not_foundtarget matches no active GameObjectCheck the name/path; only active objects are searched
ambiguous_targettarget 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_hitScreen point raycast hit nothingCheck the point is over a raycast-target element
both_endpoint_formsBoth target and screen coords supplied for one drag endpointPass one form per endpoint (target wins; this error makes it explicit)
no_target_or_screen_pointNeither object_id, target, nor screen point givenProvide one
no_cameraCamera.main is null (pointer3d)Tag a MainCamera in the scene
no_deviceKeyboard.current / Touchscreen.current is nullSet Active Input Handling to Input System; for touch on desktop, prefer inputsim_pointer
invalid_key / invalid_actionBad enum valueSee the tool's enum

Limits

  • Ambiguity detection covers every tool that takes a target. inputsim_pointer, inputsim_pointer3d, and inputsim_touch all walk active transforms and return ambiguous_target (with candidate paths) when a name/path matches more than one GameObject — none silently returns an arbitrary first match. (inputsim_pointer shares the uGUI half's PointerTargets; inputsim_touch carries its own self-contained resolver so its sub-asmdef stays independent.) inputsim_key takes no target. When a name is shared, prefer a unique path or an object_id from inputsim_probe for pointer tools. Touch accepts unique paths or screen coordinates, not object_id.
  • uGUI drag is single-frame. begin/drag×N/pointerUp/drop/endDrag dispatch in one frame. Use inputsim_step afterward to let drag-driven tweens settle.
  • hold duration is the number of advanced frames, not wall-clock. Pair hold with advance_frames for held-state polling. Hold interactions still require actual elapsed input time; duration_ms does not wait.
  • up releases 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 occluded is false (unknown), not a hard failure.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.