Skip to main content
Glama

script-execute

Compile and run C# code dynamically in Unity Editor using Roslyn. Execute temporary scripts with defined classes and static methods for immediate results.

Instructions

Compiles and executes C# code dynamically using Roslyn. The provided code must define a class with a static method to execute.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
csharpCodeYesC# code that compiles and executes immediately. It won't be stored as a script in the project. It is temporary one shot C# code execution using Roslyn. IMPORTANT: The code must define a class (e.g., 'public class Script') with a static method (e.g., 'public static object Main()'). Do NOT use top-level statements or code outside a class. Top-level statements are not supported and will cause compilation errors.
classNameNoThe name of the class containing the method to execute.Script
methodNameNoThe name of the method to execute. It must be a static method in the class provided above.Main
parametersNoSerialized parameters to pass to the method. If the method does not require parameters, leave this empty. Schema: [{"name":"string","typeName":"string","value":any}]

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/butterlatte-zhang/unity-ai-bridge'

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