Skip to main content
Glama
alexneargarder

unity-inspector-mcp

execute_script

Compile and run a C# script file in the Unity runtime. Supports full class definitions, MonoBehaviours, Harmony patches, and private member access. Scripts can define Main() for execution and Unload() for cleanup.

Instructions

Compile and run a C# script file in the Unity runtime. Supports full class definitions, MonoBehaviours, Harmony patches, and private member access. Scripts can define Main() for execution and Unload() for cleanup. Use ScriptContext for Harmony instances, logging, and arguments.

Available library scripts:

  • Dump Harmony Patches: List all Harmony patches on a specified method, showing patch owner, type, and priority [args: typeName, methodName]

  • Find Objects By Type: Find all active instances of a type in the scene with key state info [args: typeName, maxResults]

  • Inspect Private Fields: Dump all field values (including private) of a component on a named GameObject [args: gameObjectName, componentType]

  • Menu Tweaker: Live-edit FlexMenu element properties without rebuilding. Target by name, type, or wildcard pattern. [args: elementName]

  • Rogueforce Runner: Test harness for the Rogueforce mod. Start a run, skip levels, log state, auto-run a full campaign, or trigger game over. [args: action]

  • Trace Method Calls: Harmony-patch a method to log every call with arguments for a specified number of frames [args: typeName, methodName, maxCalls]

  • Watch Field: Monitor a field on a component and log whenever its value changes. Runs until unloaded. [args: gameObjectName, componentType, fieldName]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoOptional key-value arguments passed to the script via ScriptContext.Args
pathYesScript name (from scripts/csharp/) or absolute file path to a .cs file

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/alexneargarder/unity-inspector-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server