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
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Optional key-value arguments passed to the script via ScriptContext.Args | |
| path | Yes | Script name (from scripts/csharp/) or absolute file path to a .cs file |