script-execute

Compiles and executes temporary C# code dynamically using Roslyn.

1|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/Fermisloth/Project-Aegis-Adaptive-Outbreak-Containment --skill script-execute-fermisloth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: script-execute
Source: https://github.com/Fermisloth/Project-Aegis-Adaptive-Outbreak-Containment/tree/main/.agent/skills/script-execute
Command: npx skills add https://github.com/Fermisloth/Project-Aegis-Adaptive-Outbreak-Containment --skill script-execute-fermisloth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires unity-mcp-cli.

What problem does it solve? Running quick one-off C# logic inside a Unity project normally requires creating script files, waiting for recompilation, and cleaning up afterward. This Skill compiles and executes C# code in memory via Roslyn, returning the result without persisting any files. ## Core Features & Use Cases - Dynamic C# Execution: Compiles and runs C# code on the fly using Roslyn, with no permanent script added to the project. - Parameterized Method Calls: Invokes a specified static method on a defined class and passes serialized parameters to it. - Structured Results: Returns the method's output as a serialized JSON object with full type information. - Use Case: A developer wants to inspect the current state of GameObjects in a Unity scene or test a small algorithm. They pass a class with a static Main method and receive the computed result immediately, without modifying the project. ## Quick Start Ask the AI to run a temporary C# snippet through the script-execute tool, defining a class with a static method and reading the returned result.

Frequently Asked Questions about script-execute

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I execute C# code dynamically in Unity without creating a script file?

Use the script-execute tool, which compiles and runs C# code in memory via Roslyn. Provide the code in the csharpCode parameter, defining a class with a static method, and the result is returned without saving any file to the project.

How to pass parameters to a dynamically executed C# method?

Pass values through the parameters field as a serialized member list, where each entry specifies a typeName such as System.String or System.Int32 plus the value. If the target method takes no arguments, leave the parameters field empty.

Why does dynamic C# execution fail with compilation errors?

The most common cause is using top-level statements, which are not supported. The code must define a class, such as public class Script, containing a static method like public static object Main(), with all logic inside that class.

What should I do if unity-mcp-cli is not found?

Install the CLI globally with npm install -g unity-mcp-cli, or invoke it through npx unity-mcp-cli instead. Detailed setup steps are available in the unity-initial-setup skill referenced in the troubleshooting section.

Does the executed C# code persist in the Unity project?

No. The code is temporary one-shot execution compiled with Roslyn and is never stored as a script asset in the project. Each call is independent, so reusable logic should be saved separately as a normal script file.